VBA crashing on 'Left()"

K

KaiRich

Hi all,
I have a few PCs that are crashing on the vb
function 'Left'(). When any macro uses the 'Left' function
the PC crashes with "Compile Error: Can't find object or
library'.
I have searched the MS knowledge base, but the only
articles suggest opening the references box and unchecking
the offending library, but the routines for finding which
is the offending library don't work in this situation (nor
do I think that it is a valid solution to this problem).
What dll, ocx, olb, etc. is missing or corrupted to cause
vb to crash on such a basic function? Or is something else
causing this and if so how do I resolve it?
Thanks in advance, Kai
 
K

keepITcool

KaiRich wrote :

try vba.left() and your problem should be solved.
probably a naming conflict or something..
 
J

Jon Peltier

Often the line of code indicated in the crash is completely unrelated to
the error (what, you expect VBA to make sense?). If you read the Google
archives of these newsgroups, you will find this error very often (I
know, I just checked for a client), the answer is always Check for a
Missing Reference", and the OP responds with "Thanks!" My client hasn't
tried the fix yet, but I expect to hear the Thanks from him tomorrow
when he does.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
S

sebastienm

Hi,
I have seen that on xl97 but not after that version. You should get this error from any function from the Strings module from VBA. Check in the Object browser for Strings, you'll get all the functions: UCase, Left, Right, Format, ...
To prevent this from happening, you uncheck/recheck the 'Missing' library. However, it has to be done on each machine.
Another way (the one i use) is to use the code syntax 'module.function' to help VBA figure it out. eg:
Strings.UCase(s)
Strings.Left(s,2)
...
It has to be done for any occurence in the code, but once done, you shouldn't have to go on every machine.
 
S

sebastienm

Yes, that is what i meant for the second method (code Syntax Strings.function). However, i don't think (not sure though) this would work on the first method (fixing the 'Missing' Ref): if i remember correctly, fixing the problem a one of the problem-machines and redistributing that file wouldn't always work. But once again, i haven't encountered this situation for 3 years (thankfully i don't have to deal with Off97 anymore), so i don't remember exactly.
 
K

KaiRich

Sometimes, like this, it makes no sense at all!
There was a missing reference, but it was for the calendar
tool (which had caused a problem before), not for the
vba.strings library. Thanks anyhow.
 
K

KaiRich

Using VBA.Left() or Strings.Left() does work. I had to do
it for all string functions (left, right, trim, etc.). I
am making the change to the model and re-issuing to the
users. Thanks, Kai.
-----Original Message-----
Hi,
I have seen that on xl97 but not after that version. You
should get this error from any function from the Strings
module from VBA. Check in the Object browser for Strings,
you'll get all the functions: UCase, Left, Right,
Format, ...
To prevent this from happening, you uncheck/recheck
the 'Missing' library. However, it has to be done on each
machine.
Another way (the one i use) is to use the code
syntax 'module.function' to help VBA figure it out. eg:
Strings.UCase(s)
Strings.Left(s,2)
...
It has to be done for any occurence in the code, but once
done, you shouldn't have to go on every machine.
 
K

KaiRich

Using VBA.Left() works, I need to do it for all string
functions (left, right, trim, etc.) and then I'll reissue
the model to all users. Thanks, Kai
-----Original Message-----
Or it could be done on one workbook and then that workbook could be resent.
You should get this error from any function from the
Strings module from VBA. Check in the Object browser for
Strings, you'll get all the functions: UCase, Left, Right,
Format, ...the 'Missing' library. However, it has to be done on each
machine.
 
K

KaiRich

Hi, for the record; this place is using excel 2000, I
haven't had any clients with 97 for a few years either.
But I haven't come across this problem before at all. If I
had my way all clients would upgrade to xp.
-----Original Message-----
Yes, that is what i meant for the second method (code
Syntax Strings.function). However, i don't think (not sure
though) this would work on the first method (fixing
the 'Missing' Ref): if i remember correctly, fixing the
problem a one of the problem-machines and redistributing
that file wouldn't always work. But once again, i haven't
encountered this situation for 3 years (thankfully i don't
have to deal with Off97 anymore), so i don't remember
exactly.You should get this error from any function from the
Strings module from VBA. Check in the Object browser for
Strings, you'll get all the functions: UCase, Left, Right,
Format, ...the 'Missing' library. However, it has to be done on each
machine.
 
J

Jon Peltier

Didn't unchecking the missing control make the problem go away?

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
J

Jon Peltier

Of course, the other approach, Strings.Whatever, is more robust, and
what I use when a problem arises. Checking references has to be done on
all the client's machines, though it can solve a wider array of problems.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 
D

Dave Peterson

The missing calendar reference caused the left() to stop working. And the
left() wasn't associated with the calendar.

Aren't you kind of nervous that there will be a next line that will blow up
because of that still missing reference?

(I'd fix the reference.)
 
Top