Last modified: July 01, 2011
Applies to: Excel 2013 | Office 2013 | Visual Studio
Returns the instance handle of the instance of Microsoft Excel that is currently calling a DLL.
This function can be used to distinguish between multiple running instances of Excel that are calling the DLL.
This function returns a correct value with both 32-bit and 64-bit versions of Excel. It was introduced in Excel 2010 as an extension to the xlGetInst function, which works correctly only with 32-bit versions of Excel.
This function works correctly when it is called by using both the Excel4 and Excel12 varieties of the API callback functions, because both XLOPER and XLOPER12 have the same structure that supports the xltypeBigData value type.
The following example compares the instance of the last copy of Excel that called it to the current copy of Excel that called it. If they are the same, it returns 1; if not, it returns 0; if the function fails, it returns -1. This sample works with both 32-bit and 64-bit versions of Excel.