Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Trim, Len, Left causing problem

I wrote a VBA module in which I used Trim, Len, and Left functions. When I copy the WorkBook that contains the module to different systems running different OS (Win 95/98/NT/2k) cause problem at lines containing Trim, Len and Left. I checked up Reference List it was valid. What is the fix?

Advance thanx
RAJ
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 103
Default Trim, Len, Left causing problem

Have you got the same version of Excel Installed on these other machines?

--
Patrick Molloy
Microsoft Excel MVP
---------------------------------
I Feel Great!
---------------------------------
"krisrajz" wrote in message
...
I wrote a VBA module in which I used Trim, Len, and Left functions. When I
copy the WorkBook that contains the module to different systems running
different OS (Win 95/98/NT/2k) cause problem at lines containing Trim, Len
and Left. I checked up Reference List it was valid. What is the fix?

Advance thanx
RAJ



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Trim, Len, Left causing problem



"Patrick Molloy" wrote:

Have you got the same version of Excel Installed on these other machines?

--
Patrick Molloy
Microsoft Excel MVP
---------------------------------
I Feel Great!
---------------------------------
"krisrajz" wrote in message
...
I wrote a VBA module in which I used Trim, Len, and Left functions. When I
copy the WorkBook that contains the module to different systems running
different OS (Win 95/98/NT/2k) cause problem at lines containing Trim, Len
and Left. I checked up Reference List it was valid. What is the fix?

Advance thanx
RAJ



Yeah.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Trim, Len, Left causing problem

I'd take a closer look at Tools|References (make sure your project is active in
the VBE, too).

Look for MISSING in that dialog.

If (when) you find it, you'll have to decide if you need it.

If you do, you may want to go back to the developer pc and convert your code to
use late binding instead of using the references.

Dick Kusleika has a web page at:
http://www.dicks-clicks.com/excel/olBinding.htm
that explains this difference when using Outlook

It's very nice to use early binding when developing. You get all the
intellisense help (when you set the reference and declare the variables
nicely). But before you distribute it to users (who may be using different
versions), it's usually a good idea to use latebinding (and change those object
variable declarations to the generic "As Object".)



krisrajz wrote:

I wrote a VBA module in which I used Trim, Len, and Left functions. When I copy the WorkBook that contains the module to different systems running different OS (Win 95/98/NT/2k) cause problem at lines containing Trim, Len and Left. I checked up Reference List it was valid. What is the fix?

Advance thanx
RAJ


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Trim, Len, Left causing problem

Here are some more extensive references on binding:

Use late binding - don't have a reference to excel.

http://support.microsoft.com/default...b;EN-US;244167
INFO: Writing Automation Clients for Multiple Office Versions

http://support.microsoft.com/default...b;en-us;245115
INFO: Using Early Binding and Late Binding in Automation

http://support.microsoft.com/default...b;en-us;247579
INFO: Use DISPID Binding to Automate Office Applications Whenever Possible

However, if the problem is caused by going from a newer version of Excel to
an older version, the solution might be to do the development on the oldest
version.


--
Regards,
Tom Ogilvy



"Dave Peterson" wrote in message
...
I'd take a closer look at Tools|References (make sure your project is

active in
the VBE, too).

Look for MISSING in that dialog.

If (when) you find it, you'll have to decide if you need it.

If you do, you may want to go back to the developer pc and convert your

code to
use late binding instead of using the references.

Dick Kusleika has a web page at:
http://www.dicks-clicks.com/excel/olBinding.htm
that explains this difference when using Outlook

It's very nice to use early binding when developing. You get all the
intellisense help (when you set the reference and declare the variables
nicely). But before you distribute it to users (who may be using

different
versions), it's usually a good idea to use latebinding (and change those

object
variable declarations to the generic "As Object".)



krisrajz wrote:

I wrote a VBA module in which I used Trim, Len, and Left functions. When

I copy the WorkBook that contains the module to different systems running
different OS (Win 95/98/NT/2k) cause problem at lines containing Trim, Len
and Left. I checked up Reference List it was valid. What is the fix?

Advance thanx
RAJ


--

Dave Peterson





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default Trim, Len, Left causing problem

Kris,

I ran into the same problem myself. None of the requisite References were
Missing
and I eventually solved the problem by prefixing the Trim, Len, Left (and for
good measure Right and Mid) functions with the four characters "VBA." E.g., x
= VBA.Left(y,3), etc. To shorten the keystrokes as I develop programs, I
actually code this example as x = Lft(y,3) and then in a code module have:

Function Lft(StringVar As Variant, NCharacters As Long) As String
Lft = VBA.Left(StringVar, NCharacters)
End Function

-- Dennis Eisen
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
trim everything from left of first underscore in the text? Mitchell_Collen via OfficeKB.com Excel Worksheet Functions 4 July 28th 09 07:49 PM
TRIM, LEFT, RIGHT cware Excel Worksheet Functions 3 March 3rd 09 10:38 PM
Text Causing a Problem in Formula Peter[_8_] Excel Discussion (Misc queries) 7 December 18th 07 12:05 PM
left trim Finger Tips Excel Worksheet Functions 9 April 29th 07 02:40 AM
minus numbers causing a problem kevhatch New Users to Excel 14 June 30th 05 01:15 PM


All times are GMT +1. The time now is 09:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"