Creating Automation Project using Visual Studio 2010 and Excel 2010
-
Hi, I followed Microsoft Knoweldge base Article 178749 http://support.microsoft.com/kb/178749[^] To create and an Automation When I got the Class wizard I selected Create Class from typelib I the selcted the excel.exe The Wizard create a number of Class I slected to include all of them in my project After getting a Clean build I decided to add some ole code create excel So I included "CAppliction.h" I coded CApplication app; app.CreateDispatch("EXCEL APPLICATION"); however I got a whole slew of build errors example c:\users\4rypb\documents\visual studio 2010\projects\autoproject\autoproject\debug\excel.tlh(1595): error C2371: 'FontPtr' : redefinition; different basic types 1> c:\program files\microsoft visual studio 10.0\vc\include\comdef.h(314) : see declaration of 'FontPtr' or c:\users\4rypb\documents\visual studio 2010\projects\autoproject\autoproject\capplication.h(3): warning C4278: 'RGB': identifier in type library 'C:\\Program Files\\Microsoft Office\\Office14\\EXCEL.EXE' is already a macro; use the 'rename' qualifier Am I mssing some include ? The doc says include excel8.h but I dont see that included generated Thanks
-
Hi, I followed Microsoft Knoweldge base Article 178749 http://support.microsoft.com/kb/178749[^] To create and an Automation When I got the Class wizard I selected Create Class from typelib I the selcted the excel.exe The Wizard create a number of Class I slected to include all of them in my project After getting a Clean build I decided to add some ole code create excel So I included "CAppliction.h" I coded CApplication app; app.CreateDispatch("EXCEL APPLICATION"); however I got a whole slew of build errors example c:\users\4rypb\documents\visual studio 2010\projects\autoproject\autoproject\debug\excel.tlh(1595): error C2371: 'FontPtr' : redefinition; different basic types 1> c:\program files\microsoft visual studio 10.0\vc\include\comdef.h(314) : see declaration of 'FontPtr' or c:\users\4rypb\documents\visual studio 2010\projects\autoproject\autoproject\capplication.h(3): warning C4278: 'RGB': identifier in type library 'C:\\Program Files\\Microsoft Office\\Office14\\EXCEL.EXE' is already a macro; use the 'rename' qualifier Am I mssing some include ? The doc says include excel8.h but I dont see that included generated Thanks
there's going to be different headers eg excel8.h, for different versions of Excel - you've already said you're using Excel 2010, so, an alarm bell goes off in my head straight away on that score ... as to the rest, its been a long time since Ive needed to do this, but I found this article here in CP that may give you some more (and definately) better guidance .. Automating Excel 2007 and creating charts using C++ MFC application in Visual Studio 2008[^] (before you shoot me down in flames, please have a look at the article - it suggests it should be good for Excel 2010 as well, else I wouldnt have posted it)
-
there's going to be different headers eg excel8.h, for different versions of Excel - you've already said you're using Excel 2010, so, an alarm bell goes off in my head straight away on that score ... as to the rest, its been a long time since Ive needed to do this, but I found this article here in CP that may give you some more (and definately) better guidance .. Automating Excel 2007 and creating charts using C++ MFC application in Visual Studio 2008[^] (before you shoot me down in flames, please have a look at the article - it suggests it should be good for Excel 2010 as well, else I wouldnt have posted it)