Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / COM / August 2008



Tip: Looking for answers? Try searching our database.

Embed and automate an Excel worksheet by using MFC and Visual C++

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ishay44 - 28 Aug 2008 12:23 GMT
Hello!
I try to run the 'Embed and automate an Excel worksheet by using MFC'
example described in the 'Microsoft Help and Support' (URL:
http://support.microsoft.com/?kbid=311546),
Including (as described in article) for "CApplication.h", "CWorkbook.h",
"CWorksheet.h", "CRange.h", "CWorksheets.h", "CWorkbooks.h" headers file
cause many compilation errors.
I use in Visual 2005 and Excel 2007
can anybody tell me what i do wrong?

P.S. The errors I get are as follows:
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4278:
'RGB': identifier in type library 'C:\\Program Files\\Microsoft
Office\\Office12\\EXCEL.EXE' is already a macro; use the 'rename' qualifier
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4278:
'RGB': identifier in type library 'C:\\Program Files\\Microsoft
Office\\Office12\\EXCEL.EXE' is already a macro; use the 'rename' qualifier
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4192:
automatically excluding 'IFont' while importing type library 'C:\\Program
Files\\Microsoft Office\\Office12\\EXCEL.EXE'
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4192:
automatically excluding 'IPicture' while importing type library 'C:\\Program
Files\\Microsoft Office\\Office12\\EXCEL.EXE'
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4278:
'DialogBox': identifier in type library 'C:\\Program Files\\Microsoft
Office\\Office12\\EXCEL.EXE' is already a macro; use the 'rename' qualifier
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4278:
'CopyFile': identifier in type library 'C:\\Program Files\\Microsoft
Office\\Office12\\EXCEL.EXE' is already a macro; use the 'rename' qualifier
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4278:
'ReplaceText': identifier in type library 'C:\\Program Files\\Microsoft
Office\\Office12\\EXCEL.EXE' is already a macro; use the 'rename' qualifier
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4278:
'ReplaceText': identifier in type library 'C:\\Program Files\\Microsoft
Office\\Office12\\EXCEL.EXE' is already a macro; use the 'rename' qualifier
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4278:
'RGB': identifier in type library 'C:\\Program Files\\Microsoft
Office\\Office12\\EXCEL.EXE' is already a macro; use the 'rename' qualifier
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4278:
'RGB': identifier in type library 'C:\\Program Files\\Microsoft
Office\\Office12\\EXCEL.EXE' is already a macro; use the 'rename' qualifier
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4278:
'CopyFile': identifier in type library 'C:\\Program Files\\Microsoft
Office\\Office12\\EXCEL.EXE' is already a macro; use the 'rename' qualifier
d:\oleautomation\embed_excel\embed_excel\CApplication.h(3) : warning C4278:
'DialogBox': identifier in type library 'C:\\Program Files\\Microsoft
Office\\Office12\\EXCEL.EXE' is already a macro; use the 'rename' qualifier
d:\oleautomation\embed_excel\embed_excel\debug\excel.tlh(1463) : error
C2371: 'FontPtr' : redefinition; different basic types
       C:\Program Files\Microsoft Visual Studio 8\VC\include\comdef.h(322)
: see declaration of 'FontPtr'
d:\oleautomation\embed_excel\embed_excel\debug\excel.tlh(1541) : error
C2786: 'BOOL (__stdcall *)(HDC,int,int,int,int)' : invalid operand for
__uuidof
d:\oleautomation\embed_excel\embed_excel\debug\excel.tlh(1541) : error
C2923: '_com_IIID' : 'Rectangle' is not a valid template type argument for
parameter '_Interface'
       C:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\wingdi.h(3514) : see declaration of 'Rectangle'
d:\oleautomation\embed_excel\embed_excel\debug\excel.tlh(1541) : error
C3203: '_com_IIID' : unspecialized class template can't be used as a template
argument for template parameter '_IIID', expected a real type
d:\oleautomation\embed_excel\embed_excel\debug\excel.tlh(1545) : error
C2786: 'BOOL (__stdcall *)(HDC,int,int,int,int,int,int,int,int)' : invalid
operand for __uuidof
d:\oleautomation\embed_excel\embed_excel\debug\excel.tlh(1545) : error
C2923: '_com_IIID' : 'Arc' is not a valid template type argument for
parameter '_Interface'
       C:\Program Files\Microsoft Visual Studio
8\VC\PlatformSDK\include\wingdi.h(2765) : see declaration of 'Arc'
d:\oleautomation\embed_excel\embed_excel\debug\excel.tlh(1545) : error
C3203: '_com_IIID' : unspecialized class template can't be used as a template
argument for template parameter '_IIID', expected a real type
d:\oleautomation\embed_excel\embed_excel\debug\excel.tlh(1552) : error
C2371: 'PicturePtr' : redefinition; different basic types
       C:\Program Files\Microsoft Visual Studio 8\VC\include\comdef.h(336)
: see declaration of 'PicturePtr'
d:\oleautomation\embed_excel\embed_excel\debug\excel.tlh(2034) : error
C2504: '_IMsoDispObj' : base class undefined
d:\oleautomation\embed_excel\embed_excel\debug\excel.tlh(2076) : error
C2504: '_IMsoDispObj' : base class undefined
Ralph - 30 Aug 2008 07:30 GMT
> Hello!
> I try to run the 'Embed and automate an Excel worksheet by using MFC'
[quoted text clipped - 5 lines]
> I use in Visual 2005 and Excel 2007
> can anybody tell me what i do wrong?

You have included an typelib and headers which are defining the same thing.
Use the 'rename' qualifier as suggested or a full qualification.

BUT this is the wrong newsgroup. The group is for problems with classic VB
(vb6 and lower) and OLE Automation.

You will have better luck if you post in a ".vc." group, not ".vb.".

-ralph
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.