Left and Right function is not working

K

kvenku

Hi,
I am using MS-office 97. In my application when i use eithe
left,right,space,ltrim,rtrim or trim function a message 'Cannot fin
project or library' pops up.


I need to restrict the excel version below 2000.
I am using
iVersion=cint(left(cstr(application.version),2))
to find the version. But getting 'cannot find the project or library
message.

How to proceed further..can you help me out

Thanks
Venkatesh
 
F

Frank Kabel

Hi
in the VBA editor goto 'Tools - References' and check if
the MS Excel Object library is checked
 
B

Bob Phillips

Why are you using

iVersion=cint(left(cstr(application.version),2))

why not just use

If Application.Version < 9 Then

although it is a string (hence no need to Cstr), the numeric test works.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
K

kvenku

Hi,
Thanks for the information.
But MS Excel Object library is checked.even thou i am getting error.
I have to use iVersion=cint(left(cstr(application.version),2)) becaus
in
version 97
application.version is 8.0a
cint(left(cstr(application.version),2)) is 8

version 2000
application.version is 9.0
cint(left(cstr(application.version),2)) is 9

That's why i need left function. where the MS-office version 97 alon
is giving this error as 'Cannot foung project or library'.

Its very urgent..is there any other solution to do that
I am eagerly waiting for you.

Thanks

Venkates
 
B

Bob Phillips

Venkatesh,

Another reason could be that there are items in Tools>References that are
showing up as missing, other than Office. Check if there are any others, and
remove them if so.

By the way, even if that is so, you do not need then CStr as Version is a
string.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Top