Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Import msword.olb in C++

505 views
Skip to first unread message

Michael Tissington

unread,
Nov 30, 2002, 5:11:21 PM11/30/02
to
I'm trying to do an

#import of msword.olb into my C++ application but I'm getting lots of errors
to do with VBE

Where do I find the import for VBE ?

Thanks

--
Michael Tissington
Oaklodge Technologies
http://www.oaklodge.com/technology

Scot T Brennecke

unread,
Dec 1, 2002, 7:44:00 PM12/1/02
to
This will depend, of course, on the version of Office you have and the
location of your common files directory. On my machine, it's in the
E:\ProgFiles\Common\Microsoft Shared\VBA\VBA6 directory
The default is usually C:\Program Files\Common

In article <uWT4h2LmCHA.1740@tkmsftngp07>, Michael Tissington says...

Achint Srivastava [MS]

unread,
Dec 2, 2002, 7:30:43 PM12/2/02
to
You will need to #import dependent files. Here is how you do it for Office
XP and Office 2000 and 97. Also we usually recommend Class Wizard instead
of #import due to confusions arising from smart pointers and performance.
Here is an article which explains that:

Q301321 - PRB: #import Automation Fails With Two Office Versions Installed
http://support.microsoft.com/support/kb/articles/q301/3/21.asp

Here are the #import samples

///////////// begin

// uncomment the line indicate the version of Office which you wish to build

// #define _OFFICE_XP
// #define _OFFICE_2K
// #define _OFFICE_97


// Import typelib for building application with Micsosoft Office (all
version)
// the path is vary, depend on where you install Office

#ifdef _OFFICE_XP
///////////////////////////////////////////////////////////////////////

// Word XP
#import "C:\PROGRAM FILES\COMMON FILES\MICROSOFT SHARED\OFFICE10\MSO.DLL"
#import "C:\Program Files\Common Files\Microsoft
Shared\VBA\VBA6\VBE6EXT.OLB" #import "D:\PROGRAM FILES\MICROSOFT
OFFICE\OFFICE10\MSWORD.OLB" \
rename("ExitWindows","MsoExitWindows")

// Excel XP
#import "D:\Program Files\Microsoft Office\Office10\EXCEL.EXE" \
rename("DialogBox","MsoDialogBox") rename("RGB","MsoRGB")

#elif defined(_OFFICE_2K)
///////////////////////////////////////////////////////////////////////

// Word 2k
#import "C:\Program Files\Microsoft Office\Office\MSO9.DLL"
#import "C:\Program Files\Common Files\Microsoft
Shared\VBA\VBA6\VBE6EXT.OLB" #import "C:\PROGRAM FILES\MICROSOFT
OFFICE\OFFICE\MSWORD9.OLB" \
rename("ExitWindows","MsoExitWindows")

// Excel 2k
#import "C:\Program Files\Microsoft Office\Office\EXCEL9.OLB" \
rename("DialogBox","MsoDialogBox") rename("RGB","MsoRGB")

#elif defined(_OFFICE_97)
///////////////////////////////////////////////////////////////////////

// Word 97
#import "C:\Program Files\Microsoft Office\Office\MSO97.DLL"
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBEEXT1.OLB"
#import "C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\MSWORD8.OLB" \
rename("ExitWindows","MsoExitWindows")

// Excel 97
#import "C:\Program Files\Microsoft Office\Office\EXCEL8.OLB" \
rename("DialogBox","MsoDialogBox") rename("RGB","MsoRGB")

#else

// warning for importing typelib
#error *** You have to specify a version of Microsoft Office in order build
this application successfully ***

#endif
///////////// end

Hope this works for you

Thanks!
Achint Srivastava
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.

0 new messages