Click here to Skip to main content
15,892,517 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,I wanna operate the excel file in MFC project.And I use excel2010 in win7 system.So I clicked Project->Add Class->TypeLib Class,add six interfaces,_Application,_Workbook,Workbooks,_Worksheet,Worksheets,Font,Range.I deleted all #import that TypeLib wizard produced,and add sth on the top of file like this:
C#
#import "C:\Program Files\Common Files\Microsoft Shared\OFFICE14\MSO.dll" \
    rename("RGB","MSRGB"),\
    rename("DocumentProperties","JOEDocumentProperties")
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB" raw_interfaces_only,\
    rename("Reference","ignorethis"),rename("VBE", "JOEVBE")
#import "C:\Program Files\Microsoft Office\OFFICE14\excel.exe" exclude("IFont","IPicture") \
    rename("RGB","ignorethis"),rename("DialogBox", "ignorethis"),\
    rename("VBE","JOEVBE"), rename("ReplaceText","JOEReplaceText"),\
    rename("CopyFile","JOECopyFile"),rename("FindText","JOEFindText"),rename("NoPrompt", "JOENoPrompt")
using namespace Office;
using namespace VBIDE;
using namespace Excel;


But there still exist 24 errors which are following:

error C2872: “Application”: ambiguous symbol
maybe Excel::Application
or VBIDE::Application
error C2259: “Excel::Filter”: cannot instantiate abstract class due to following members
“HRESULT IUnknown::QueryInterface(const IID &,void **)”: is abstract
refer to the declare of “IUnknown::QueryInterface”
***************

What's wrong with my code??
Posted

1 solution

Please see the following articles:



Both of those articles will also need the information in this KB article:



Hope that helps.
 
Share this answer
 
Comments
Leasangle 22-Apr-11 1:05am    
I read that,but error C2872 and C2259 above still exist.By the way,the three articles aren't mention about excel2010 in win7.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900