Compile error on "Right", missing Library

S

Sige

Hi There,


I am running a piece of code but I bug on: "Right"

ExportFormat = UCase(Right(FileSaveName, 3))

Compile Error: Cant find Project or Library


Which reference should I need to set???

Sige

PS I am working in XL97 ...
 
N

Norman Jones

Hi Sige,

In the VBE, with the problematic workbook's project selected, go to:

Tools | References

and look for any entries marked 'Missing'.

Uncheck these if they are not needed or use the browse button to locate the
reference.
 
S

Sige

Hi Norman,

Wished I could ... but I cannot uncheck it as it is in use ....
I can browse yes ...but to which reference?

Sige
 
S

Sige

Missing Location:
C:\Sige\Excel\Test
Language: Standard

I did not set any reference ... ?!

Is "Right" not a standdard VBA-function?
(or part of ATPVBAEN.xla? which is checked!)

Sige
 
H

Helmut Weber

Hi Sige,

it seems, if a reference is missing
or something else is wrong with a library,
the compiler simply stops at the first keyword
it comes across. Is has nothing to do with right.

Helmut Weber
 
N

Norman Jones

Hi Sige,

Has the missing reference file been moved or renamed? If so, browse to the
new location / name and reset the reference.
 
P

Peter T

Just to add, vba string & datetime functions are particularly prone to not
working with missing ref's. You can temporarily fix by fully qualifying, eg

s = VBA.Strings.Right(myString,1)

One reason for a missing ref might be if a project was written & compiled in
a later version of Excel than it is currently being used in.

Regards,
Peter T
 
S

Sige

Hi Guys,

I was playing on this workbook yesterday at home in XL2003... while now
(at work) I use XL97. Maybe that has something to do with it.
Nevertheless I have not set any particular reference for this workbook.

The magic "trick": I asked for a complete reset of my Excel at work.
AND now it works!!!!

The references for thhis workbook are:
-Visual Basic for Applications
-Microsoft Excel 8.0 Object Library
-OLE automation
-Microsoft Forms 2.0 object Library
-Microsoft Office 8.0 Object Library
-Ref Edit Control ===> this is bizar I think ...

Any of them referring to the previous MISSING-ref which was indicated
to be in "C:\Sige\Excel\Test"

The "problem" is solved ...but the WHY ...still bothers me.

Sige
 
P

Peter T

The "problem" is solved ...but the WHY ...still bothers me.

See the second part of my earlier post which, it now appears, correctly
guessed the route of your problem.

Regards,
Peter T
 

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