I've been working on a WTL utility recently that utilizes Excel 2007. I spent quite a bit of time determining how to use #import to bring Excel 2007 into my WTL/C++ project.
Here are the #import statements I worked out, with help from google:
#import "C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE12\\MSO.DLL" \
rename( "RGB", "MSORGB" ) \
rename( "DocumentProperties", "MSODocumentProperties" ) \
no_function_mapping
#import "C:\\Program Files\\Common Files\\Microsoft Shared\\VBA\\VBA6\\VBE6EXT.OLB"
#import "C:\\Program Files\\Microsoft Office\\OFFICE12\\EXCEL.EXE" \
rename( "DialogBox", "ExcelDialogBox" ) \
rename( "RGB", "ExcelRGB" ) \
rename( "CopyFile", "ExcelCopyFile" ) \
rename( "ReplaceText", "ExcelReplaceText" ) \
exclude("IFont","IPicture") \
no_function_mapping
The above #import statements were worked out to cause as little trouble as possible when working with the DSOFramer ActiveX control example.
One of my favorite tricks is to create a fake project to generate header files from the #import statements. Once the headers are created, they can be utilized in place of the #import statements in your project. I like generating headers so I can modify the interface calls to utilize ATL classes like CComBSTR and CComVariant, rather than relying on the compiler supported classes _bstr_t and _variant_t. The latter classes are very "heavy weight" with a lot of functionality not usually required for most WTL projects.