Call Excel from VC++ Win32 DLL
Hi
I am writing a VC++ Win32 DLL, and in one of the functions that I'm exporting I need to do the equivalent of the following VB code: Dim oExcelApp as Object ‘ oExcelApp gets set to Excel.Application in call to third party DLL oExcelApp.ActiveSheet.ChartObjects(1).CopyPicture In my VC++ project oExcelApp is declared as follows: IDispatch *pExcelApp; How can I implement the functionality in the VB code above in VC++? I've searched various news groups and MSDN and it seems that I have two choices: 1) use the #import directive (excel9.olb) 2) work with such APIs as CoCreateInstance(), and COM interfaces such as IDispatch I try the #import but I get loads of compilation errors, for example: error C2504: '_IMsoDispObj' : base class undefined With point 2, surely I still have to include some files to include references to Excel? Also I'm not sure how to even go about this. Please can someone give me step-by-step instructions on how to call Excel from VC++. Many thanks. Julia. |
All times are GMT +1. The time now is 05:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com