Compile Error

J

Joe Drzal

Hello -

I have a VBA application in Excel that opens word
documents for importing data.

Occassionally the users receive the following error -
COMPILE ERROR IN HIDDEN MODULE: DATAUPDATES

Upon investigation I find the following in the VBA
References
1 - "MISSING Microsoft Word 10.0 Object Library" is
checked
2 - "Microsoft Word 9.0 Object Library" is NOT checked

By removing the reference to 10.0 and checking the 9.0
reference., all is well for a few days till it repeats.

Does anyone know what causes this?? Can it be corrected
automatically??

Thanks,

Joe Drzal
 
P

Peter Hewett

Hi Joe

Essentially when you create the project reference you have to reference the
lowest version of the application you want to use. In your case you have a
reference to Word 10 (XP, aka 2002). You can do one of two things:

1. Delete the current reference and create a reference to Word 9 (2000)
instead.
2. Delete the reference and change from early binding to late binding. To do
this you would typically do something like this:

Dim wdApp as Object
Set wdApp = CreateObject("Word.Application")

instead of:

Dim wdApp as Word.Application
Set wdApp = New Word.Application


HTH + Cheers - Peter
 

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