xlAutoOpen

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

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);

Parameters

This function takes no arguments.

Property Value/Return Value

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

Remarks

Microsoft Office 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, SAMPLES\GENERIC\GENERIC.C, and SAMPLES\STOCK\STOCK.CPP for example implementations of this function.

See Also

Reference

xlAutoClose

xlAutoRegister/xlAutoRegister12

Concepts

Add-in Manager and XLL Interface Functions