'Can't find project or library' error

B

BRG

Hello,

I have developed an application that runs without problems on a number of
machines, but I keep getting a 'Can't find project or library' error on one
machine. The only difference between the machines that I can find is that
the problem one is running Excel 2003, SP2 as opposed to the others which are
running Excel 2003 SP3.

When the error occurs a variable name is always highlighted, and explicitly
defining the variable fixes the problem. Another application I have
developed without explicitly defining all variables works on the problem
machine. Another difference between the applications is that the problem one
uses an add in called 'XY Chart Labeller'. I'd rather not have to go through
all of the code and explicity define all variables. Any ideas on another way
to fix this would be greatly appreciated.
 
P

Peter T

Sounds like a missing reference problem (look in Tools, References), and/or
a project that was developed in a later version being used in an earlier
version.
When the error occurs a variable name is always highlighted, and
explicitly
defining the variable fixes the problem.

What is the variable type and what do you mean be explicitly defining fixes
it.

It's highly unlikely that the addin 'XY Chart Labeller' is implicated.

Regards,
Peter T
 
B

BRG

The tool was developed using Excel 2003 SP3, is this likely the problem? Is
there any way to fix this (other than updating to SP3)?

What am I looking for in References? The tool is entirely in Excel, doesn't
have any references or import any data from any other applications, and I
have the VBA and Excel 11.0 object library selected.
 
P

Peter T

First thing to do is, in the machine that's giving the problem look in Tools
References for any reference marked as MISSING and uncheck.

Re SP3, if you mean and subsequently deployed in SP2 I'm not sure. Probably
not at issue but it just might be, depending on what has been used. One way
to find out would be to rebuild the project in the older system. Export all
the code modules to file and reimport to a new project (you can export from
the problematic file, ie can do all within the same system).

Why not answer the two questions I asked last time in case that sheds any
light.

Regards,
Peter T
 
B

BRG

Sorry about that, I saw the > and thought that was the end of your post.

The variable types are varied, the first ones I ran into were 'Commandbar'
and 'CommandBarControl'. Now that those work, I am running into problems
with integer, string, and boolean variables, when giving them an initial
value (ie i = 7) or in 'For Each' loops (ie For Each sh in Sheets).

By explicitly defining them, I mean using a Dim statement (or a Public
statement for a global variable). It seems VB thinks my variable names are
names of objects that it can't find in a library, unless I explicitly define
them as variables.

I'll take a look for anything labeled as MISSING in References. Thanks for
the help!
 
P

Peter T

It's always very worthwhile to fully declare variables. However I can't
think of anything that would cause a problem doing simply
i = 7
even if ' i ' had not been declared. Unless perhaps if ' i ' had already
been used as an object variable. Even then it would be a different type of
error.

Are you saying the code breaks on "i = 7" with that highlighted and a msg
saying 'Can't find project or library'

Regards,
Peter T
 
B

BRG

I think I will be fully declaring them in the future. None of the variable
names have been used as an object variable.

Yes, the code breaks at "i = 7" with the "i =" highlighted and the error
message "Compile error: Can't find object or library". When using "For
Each" statements, only the variable name is highlighted.
 

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