Compile Error when referencing library

  • Thread starter Thread starter Mike Kosty
  • Start date Start date
M

Mike Kosty

I get the following error when running a module in VBA:

"Compile Error: Can't find project or library"

Thing is, it happens randomly. Sometimes it works,
sometimes it doesnt. I've relinked the library (MS Office
9.0 Object Library), but the References box still lists
the library as missing. Its there, I can look at it on
the harddrive, but it still doesnt work.

MS Access 2000
 
1) It is often a good idea to get rid of the reference
to the Office library and use GetObject/CreateObject
instead of New, and 'as object' instead of 'as word.doc'
just so that you don't get general VBA problems when
the reference is 'missing'

2) Sometimes, it is a good idea to write code with
explicit references to the relevant library: 'dim
frm as Access.Form', 'vba.vbcrlf', 'vba.msgbox'

3)If the file is there, but the reference is 'missing',
then the file is corrupt or incorrectly installed.

(david)
 
Back
Top