Automate Excel from MFC and Visual C++ 2005 problems

I

Ishay44

Hello!
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:
http://support.microsoft.com/kb/308407),
and I run into same problem as described in the MSDN Forums "Newbie Q
regarding MFC automation client app"
(http://forums.msdn.microsoft.com/en-US/vcgeneral/thread/9ae455c1-76fc-40ff-8f8f-d0682597d6a6/)

For solving it as described in the MSDN Forums "using excel type library in
vc++2005"
(http://forums.msdn.microsoft.com/en-US/vcgeneral/thread/1de6c74f-6cf0-4d91-a5a9-e85853b867f6/)
) 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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top