VBA unable to recognize code after reinstallation of MS Office

E

Edmund

After reformatting my harddisk & full re-installation of Microsoft Office
2003,my VBA can no longer execute the below codes. I get error message
"Compile error: Can't find project or library".

Now, VBA doesn't seem to recognize "Trim" & "Format" as in below codes.
What's missing from my installation?

Trim(MyString)
Msg = "Job done in : " & Format(endtimer - starttimer, "0.0") & " secs"

Thanks in advance.
 
B

Bob Bridges

I'm a newbie at this, but since you just reformatted and reinstalled, check
your References to be sure that the required libraries are referred to by
your VBA/Excel. In the VB Editor, go to Tools, References, and see to it
that two boxes are checked...let's see, here, I just read about this...ah,
here it is. In my version (also 2003) when I hit the Help button I see this
line:

"NOTE: You can't remove the 'Visual Basic For Applications' and 'Visual
Basic objects and procedures' references, because they are necessary for
running Visual Basic."

Now, this note is apparently not strictly true, for in my version I see that
"Visual Basic For Applications" is checked, but "Visual Basic objects and
procedures" is not. Still, it seems likely to me that your missing functions
might be in one or both of those libraries, and that by checking those boxes
you might restore their functionality.
 
D

Dave Peterson

Open the workbook with the problem
Go into the VBE
Select that workbook's project
Click on Tools|References, look for a MISSING reference.

Delete it or replace it with one that you need.

Missing references can cause errors that have no relationship to the line that's
marked as error.
 
J

Jon Peltier

Dave Peterson said:
Open the workbook with the problem
Go into the VBE
Select that workbook's project
Click on Tools|References, look for a MISSING reference.

Delete it or replace it with one that you need.

Missing references can cause errors that have no relationship to the line
that's
marked as error.

But a sure sign that a reference is missing is a compile error on a member
of the Strings library, such as Trim, Format, Left, etc. Strings is the
canary in the VBA coal mine.
- Jon
 

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