_Application.GetThisWorkbook() in a C++ add-in

U

um

Hello comrades,

I need to get an OLE reference to the worksheet of the instance of Excel
which called this add-in. I am using the following:

_Application pExcelApp;
Workbooks pWorkbooks;
pExcelApp.CreateDispatch("Excel.Application");
pWorkbooks=pExcelApp.GetThisWorkbook();

The last line crashes "Can not get GetThisWorkbook() of this application..."

_Application and Workbooks are defined in excel8.cpp and excel8.h. The
pExcelApp object is instantiated, since I can do other things with it and it
looks good.

What am I doing wrong???

Thanks a mille!!

um
 
Top