adding reference to the Word-Library

G

Guest

Hi,

For an application i'm wirting in Excel (VBA) I will open a template in Word and add information to that template from within my Excel-sheet.

I've discovered that I need a reference for that to the Word-Library. (Tools -> References -> etc...)

The problem is that when someone tries to run the application on a computer that doesn't have that reference enabled, the code doesn't work...

Does anyone know how to check whetter the reference is made or not and, -if not- how to enable it?

Greets

Guido van Gemerden
g.vangemerden*NOSPAM*@*PLEASE*basic-it.nl
 
P

papou

Hi Guido
Please note file name reference differs according to office version
installed (code below works with Office xp and 2003)
On Error Resume Next
MyRef = ThisWorkbook.VBProject.References("Word").Description
If Err <> 0 Then
ThisWorkbook.VBProject.References.AddFromFile (Application.Path &
"\MSWORD.OLB")
End If
HTH
Regards
Pascal

"Guido van Gemerden" <Guido van (e-mail address removed)> a écrit
dans le message de
Hi,

For an application i'm wirting in Excel (VBA) I will open a template in
Word and add information to that template from within my Excel-sheet.
I've discovered that I need a reference for that to the Word-Library.
(Tools -> References -> etc...)
The problem is that when someone tries to run the application on a
computer that doesn't have that reference enabled, the code doesn't work...
Does anyone know how to check whetter the reference is made or not
and, -if not- how to enable it?
 

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