xlAutoOpen

Last modified: May 14, 2009

Applies to: Excel 2010 | Office 2010 | VBA | Visual Studio

Callback function that must be implemented and exported by every valid XLL. The xlAutoOpen function is the recommended place from where to register XLL functions and commands, initialize data structures, customize the user interface, and so on.


int WINAPI xlAutoOpen(void);

This function takes no arguments.

Your implementation of this function must return 1 (int).

Microsoft Excel calls xlAutoOpen whenever the XLL is activated. The XLL is activated in the following situations:

  • At the start of an Excel session if it was active in the last Excel session that ended normally.

  • If loaded during an Excel session.

  • An XLL can be loaded in several ways:

  • By choosing Open on the File menu (where the version of Excel supports this method of loading XLLs).

  • Using the Add-In Manager.

  • From another XLL that calls xlfRegister with the name of this DLL as the only argument.

  • From an XLM macro sheet that calls REGISTER with the name of this DLL as the only argument.

  • If the add-in is deactivated and reactivated during an Excel session, this function is called on reactivation.

Example

See the files SAMPLES\EXAMPLE\EXAMPLE.C and SAMPLES\GENERIC\GENERIC.C, and for example implementations of this function.

Show:
© 2015 Microsoft