Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Win32 error on mixed office software Carole UK Excel Discussion (Misc queries) 2 June 20th 07 09:05 PM
MS Excel Error - Win32 exception Jahrzee Setting up and Configuration of Excel 0 May 28th 07 03:38 AM
Call Center Management: How to calculate 'cost per call' Denniso6 Excel Discussion (Misc queries) 2 June 25th 06 05:01 PM
Not a valid Win32 file ? davestanyon Setting up and Configuration of Excel 0 May 9th 05 05:54 PM
Call Excel from VC++ Win32 DLL Julia[_2_] Excel Programming 0 December 8th 03 04:46 PM


All times are GMT +1. The time now is 12:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"