Word Automation Compiling error

L

LeonXYZ

My Dear friends,

I am building an application with Word automation, I added 3 MFC class from
Typelib, CDocument, CDocuments and CApplication
The head file contains
#import "C:\\Program Files\\Microsoft Office\\Office12\\MSWORD.OLB"
rename("ExitWindows","ExitWindows1") rename("FindText","FindText1")
rename("Calculate","Calculate1")

but the compiler give a lot of similar errors for lines like below
__declspec(property(get=GetFonts))
WebPageFontsPtr Fonts;
__declspec(property(get=GetCustomXMLPart))
_CustomXMLPartPtr CustomXMLPart;
CustomXMLNodePtr GetCustomXMLNode ( );
error C2146: syntax error : missing ';' before identifier 'Fonts'
error C4430: missing type specifier - int assumed. Note: C++ does not
support default-int

I think I must missed some point here.

Any help would be very appreciated.

LeonXYZ
 
L

LeonXYZ

all error C2146 and error C4430 are caused by msword.tlh.
It seems that a few types below are not defined:
WebPageFontsPtr,
_CustomXMLPartPtr,
CustomXMLNodePtr,
AssistantPtr,
LanguageSettingsPtr,
AnswerWizardPtr,
FileDialogPtr,
_CommandBarsPtr,
FileSearchPtr,
VBEPtr,
NewFilePtr,

Do I have to include or import some other files as well ?

Thanks a million for your help
 
F

fefe

If you look at the first few lines of msword.tlh, you'll find the following
statement:
//
// Cross-referenced type libraries:
//
// #import "C:\Program Files\Common Files\Microsoft Shared\OFFICE12\MSO.DLL"
// #import "C:\Program Files\Common Files\Microsoft
Shared\VBA\VBA6\VBE6EXT.OLB"
//

So import those two files before msword.tlb please.
 

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