ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   adding reference to the Word-Library (https://www.excelbanter.com/excel-programming/301476-adding-reference-word-library.html)

Guido van Gemerden

adding reference to the Word-Library
 
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


Papou

adding reference to the Word-Library
 
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").Descript ion
If Err < 0 Then
ThisWorkbook.VBProject.References.AddFromFile (Application.Path &
"\MSWORD.OLB")
End If
HTH
Regards
Pascal

"Guido van Gemerden" <Guido van 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?

Greets

Guido van Gemerden





All times are GMT +1. The time now is 12:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com