"can't find project or library" error has started appearing in VBArunning on Word 2003

P

PeterEvans

I have been developing a Word VBA in 2007 and I have just come across
some machines using Office 2003 which produce the following error
"Compile error: can't find project or library"

The lines that are highlighted include things like
daystogo = DateDiff("d", Date, maDateExpire)
with Date highlighted

When I type
debug.print date
into the immediate window i see the same message

If I type
debug.print vba.date
into the immediate window all is OK

Why is this error occurring and how can I solve it.

I have looked at
http://cpap.com.br/orlando/VBADecompilerMore.asp?IdC=Help
but this does not resolve the issue

PeterEvans
 
P

Paul Shapiro

In the VBA editor, go to the Tools->References menu. Most likely one or more
of the references are marked as 'MISSING:' and need to be resolved. In VBA,
when any reference is missing none of the code executes, so the particular
error line doesn't mean anything.
 
P

PeterEvans

Thanks ... but in the TOOLS menu the REFERENCES item is greyed out.

Has the project somehow lost a reference to vba 'cos n the immediate
window
debug.print date
produces the "Compile error: can't find project or library" error

and
debug.print vba.date
produces the date

Is there any way to reset the references if the REFERENCES item is
greyed out.

Thanks in advance for any assistance,
PeterEvans
 
P

Paul Shapiro

Is the project locked or the Word document read-only? Check the Properties
of the Project. I think that if Word is able to open the document then VBA
exists and the menu is potentially able to work. Date() won't work if ANY
reference is missing, so there's no reason to think VBA is missing because
of that.

Thanks ... but in the TOOLS menu the REFERENCES item is greyed out.

Has the project somehow lost a reference to vba 'cos n the immediate
window
debug.print date
produces the "Compile error: can't find project or library" error

and
debug.print vba.date
produces the date

Is there any way to reset the references if the REFERENCES item is
greyed out.

Thanks in advance for any assistance,
PeterEvans
 
D

Doug Robbins - Word MVP on news.microsoft.com

Have you tried clicking on Reset on the Run menu in the VBE

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Thanks ... but in the TOOLS menu the REFERENCES item is greyed out.

Has the project somehow lost a reference to vba 'cos n the immediate
window
debug.print date
produces the "Compile error: can't find project or library" error

and
debug.print vba.date
produces the date

Is there any way to reset the references if the REFERENCES item is
greyed out.

Thanks in advance for any assistance,
PeterEvans
 
P

Peter

Thanks Paul and Doug,

I've unlocked the project and i can now click the referrences menu and I can
see that the missing. the one with Missing next to it is:
MISSING: EndNote Cwyw.dotm

I have Endnote on one of my machines but not on the other and my project has
nothing to do with Endnote and the missing reference to Endnote Cwyw.dotm
shows up on both of them.

How do I get rid of the reference to Endnote Cwyw.dotm in my project?

PeterEvans
 

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