Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to start Word and open a specific document from an Excel module

Status
Not open for further replies.

GVF

Programmer
Feb 25, 2005
160
US
Hello,
I have a help menu with a menuitem that when selected will start Word and open a specific document (my instructions for my Excel addin).

When I create an object of the Word Application and reference the Word object library in my Excel project the following occurs.

If I compile in Excel 2000 and reference the Word 9.0 object library everything is OK. The addin works in XP and 2000.

If I compile in Excel XP the addin doesn't work in Excel 2000 because VB changes the object library to version 10.0. (Excel 2000 is not loaded on the machine I code on)

I have tried to save my XLS file in Excel 2000 with the 9.0 object library referenced but when I open the XLS file in Excel XP, the 10.0 object library is listed in the referenes, not the 9.0. Then, when I compile as an addin, it won't run in Excel 2000.

Is there a way to start Word and open the document without having to create an object?
I need this for backwards compatibility with Excel 2000.

Greg
 
You may consider late binding, ie no references to the Word object library:
Dim myWDapp As Object
Set myWDapp = CreateObject("Word.Application")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV,

I was using

Dim MyWDapp as Word.Application

which required the reference.

Greg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top