By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 765 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

Automate Excel from MFC and Visual C++ 2005 problems

P: 3
I try to build (using Visual 2005 and Excel 2007) the example described in the Microsoft Help and Support "How to automate Excel from MFC and Visual C++ 2005 or Visual C++ .NET to fill or obtain data in a range using arrays" (URL:,
and I run into same problem as described in the MSDN Forums "Newbie Q regarding MFC automation client app" (

For solving it as described in the MSDN Forums "using excel type library in vc++2005" ( ) I replaced the '#import' command in the 'CApplication.h', 'CRange.h', 'CWorkbook.h', 'CWorksheet.h', 'CWorkbooks.h', 'CWorksheets.h' headers file create by the 'MFC Add Class Wizard' (class wrappers from the type library)
"#import "C:\\Program Files\\Microsoft Office\\Office12\\EXCEL.EXE" no_namespace" with the following three imports
"#import "C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE12\\mso.dll" rename("RGB", "MSRGB")"
"#import "C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA6\\VBE6EXT.OLB" raw_interfaces_only, rename("Reference", "ignorethis"), rename("VBE", "testVBE")"
"#import "C:\\Program Files\\Microsoft Office\\OFFICE12\\excel.exe" exclude("IFont", "IPicture") rename("RGB", "ignorethis"), rename("DialogBox", "ignorethis"), rename("VBE", "testVBE"), rename("ReplaceText", "EReplaceText"), rename("CopyFile","ECopyFile"), rename("FindText", "EFindText"), rename("NoPrompt", "ENoPrompt")"

but now the compiler doesn't recognized ("error C4430: missing type specifier") to the types 'Application', 'XlCreator', 'Border , 'Interior', 'ChartFormat' locate in the 'CRange.h', 'CWorkbook.h', 'CWorksheet.h', 'CWorkbooks.h', 'CWorksheets.h' headers file!

Can anybody tell me what I do wrong?
Sep 1 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.