View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
um um is offline
external usenet poster
 
Posts: 12
Default _Application.GetThisWorkbook() in a C++ add-in

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