locked
add CWorkbooks.h brings 57 problems RRS feed

  • Question

  • my project is running ok ,but when I add a new class CWorkbooks.h from Microsoft Excel 11.0 Object Library<1.5> and include  it to my project,it brings 666 problems.My project is running in vs2005.

    CWorkbooks.h
    #import "C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE" no_namespace
    class CWorkbooks : public COleDispatchDriver
    {
    public:
     CWorkbooks(){} // 调用 COleDispatchDriver
    ........
    it running 666 problems:
    14 error C2786: 'BOOL (__stdcall *)(HDC,int,int,int,int)' : invalid operand for __uuidof  excel.tlh 1297 
    15 error C2923: '_com_IIID' : 'Rectangle' is not a valid template type argument for parameter '_Interface'  excel.tlh 1297
    16 error C3203: '_com_IIID' : unspecialized class template can't be used as a template argument for template parameter '_IIID', expected a real type  excel.tlh 1297
    .............
    When it replace"#import "C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE" no_namespace " with"#import "C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE11\\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\\Office11\\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")  "
    It just have 57 problems,but I still can solve these problem,who can help me.Thanks in advance. My email is
    a3367663@126.com

    the list of 57errors  :
    1 error C2146: syntax error : missing ';' before identifier 'get_Application'  cworkbooks.h 24
    2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int  cworkbooks.h 24
    3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int  cworkbooks.h 25
    5 error C2146: syntax error : missing ';' before identifier 'get_Creator'  cworkbooks.h 30
    6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int  cworkbooks.h 30
    7 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int  cworkbooks.h 31
    9 error C2061: syntax error : identifier 'Parameter' cworkbooks.h 42
    10 error C2061: syntax error : identifier 'Parameter' cworkbooks.h 55
    11 error C2146: syntax error : missing ';' before identifier 'get__Default'  cworkbooks.h 62
    12 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int cworkbooks.h 62
    13 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int cworkbooks.h 63
    15 error C2065: 'Application' : undeclared identifier  cworkbooks.h 26
    .........................
    Tuesday, March 31, 2009 2:10 PM

All replies

  • comment #import "C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE" and it will solve your problem.

     

    Saturday, July 23, 2011 4:58 PM