ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   _Application.GetThisWorkbook() in a C++ add-in (https://www.excelbanter.com/excel-programming/301247-_application-getthisworkbook-c-add.html)

um

_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




All times are GMT +1. The time now is 02:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com