Trim: Excel 97 gives error "Can't find project or library"

  • Thread starter Thread starter Jim Mooney
  • Start date Start date
J

Jim Mooney

I don't know why Trim(...) function does not work in the
Excel programming section of a worksheet for Excel 97. I
also have a copy of Office 2003 and it works fine with
this version.

How do I convert this statement in Office 2003:

Name = Trim(Name)

to work in Office97? The error keeps coming up:

Can't find project or library

Trim is highlighted.
 
Hi,

Try Name=WorksheetFunction.Trim(Name)

Kind regards.

--
Haldun Alay


"Jim Mooney" <[email protected]>, iletide sunu yazdi I don't know why Trim(...) function does not work in the
Excel programming section of a worksheet for Excel 97. I
also have a copy of Office 2003 and it works fine with
this version.

How do I convert this statement in Office 2003:

Name = Trim(Name)

to work in Office97? The error keeps coming up:

Can't find project or library

Trim is highlighted.
 
Jim,

Try going into Tools>References in the VBE, and see if there is a Missing
reference in the list. If there is, uncheck it. You may need to browse for
the correct version to ensure that things still work.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
I did encounter a similar problem with Excel 2003 when using the Option
Explicit statement at the beginning of the program. I had a ClearSheet
subroutine which used statements like:

Range("A2:J345") = xlClearContents

This statement works when not using the Option Explicit statement but does
not when I use the Option Explicit statement. Does Excel 97 have this option
automatically enabled and if so is there a way to disable it? Or is there
another solution to this problem?
 
Hi Jim,

The use of Option Explicit is optional but *highly* desirable.

To set the default to non-use, in the VBE :

Tools | Options | Editor | Require Variable Declararion <== Uncheck


With Option Explicit invoked,
Range("A2:J345") = xlClearContents

errors because,syntatically, this should be:

Range("A2:J345").ClearContents


Regards,
Norman
 
Hi Jim,
The References Option is greyed out and I am unable to select it.

This would happen if you are in break mode - press the macro reset button
and then try Bob's suggestion.
 
it actually errors (with option explicit) because there is no predefined
constant

xlClearContents

if he declared

Dim xlClearContents as Variant

then it would work fine althought the use of the clearcontents method (as
you point out) is the provided method and probably should be employed.
 
How many are checked now <shudder>

There shouldn't be more than 5 checked (of course which 5 would be
important).
 
Back
Top