Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Wrong number of arguments - Help

Hi all, i am trying to get the file name and then trim off the ".xls"
from the end.
myFileName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)

This then give me an error as per the subject line. Please could
somebody give me some help.

thanks.


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Wrong number of arguments - Help

Have you checked if there are any MISSING references in the VBIDE,
ToolsReferences.

--
HTH

Bob Phillips

"Les Stout" wrote in message
...
Hi all, i am trying to get the file name and then trim off the ".xls"
from the end.
myFileName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)

This then give me an error as per the subject line. Please could
somebody give me some help.

thanks.


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Wrong number of arguments - Help

Hi, i am sorry i do not understand what is meant by the references in
the VBIDE,
ToolsReferences. I understand that i must go to the tools and then
references, but do not know what to look for as there are so many that
are not flagged ??


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Wrong number of arguments - Help

You look for the words MISSING in all caps. It would be a selected
reference so it would be in the group that are checkmarked at the top.

As far as the code goes - from the immediate window:


myFileName = Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)
? myFileName
American Express1

gives the correct answer. I assume myFilename is dim'd as String or Variant
or not declared.
--
Regards,
Tom Ogilvy


"Les Stout" wrote in message
...
Hi, i am sorry i do not understand what is meant by the references in
the VBIDE,
ToolsReferences. I understand that i must go to the tools and then
references, but do not know what to look for as there are so many that
are not flagged ??


Les Stout

*** Sent via Developersdex http://www.developersdex.com ***



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Wrong number of arguments - Help

Hi Tom, i checked and only the following are checked:
Visual Basic for Applications
Microsoft 10.0 Object Library, &
Microsoft Visual Basic for applications 5.3

If i change the "left" to "right" it works ??
but the left does not, even in my immediate window !! i do not
understand ?

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Wrong number of arguments - Help

References are specific to the activeproject. Make sure the problematic
workbook is selected in the Project Manager in the VBE (it is highlighted).
then do tools=References.

Also, look in the object browser and search for left in the VBA library.

if nothing helps, try the kludge

myFileName = VBA.Left(ActiveWorkbook.Name, Len(ActiveWorkbook.Name) - 4)

--
Regards,
Tom Ogilvy

"Les Stout" wrote in message
...
Hi Tom, i checked and only the following are checked:
Visual Basic for Applications
Microsoft 10.0 Object Library, &
Microsoft Visual Basic for applications 5.3

If i change the "left" to "right" it works ??
but the left does not, even in my immediate window !! i do not
understand ?

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Wrong number of arguments - Help

Thanks Tom, will try in the morning, 21:25 here and time to go home.
cheers

Thanks

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
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
Nested IF's with Logical Arguments - Doing something wrong here ConfusedNHouston Excel Discussion (Misc queries) 1 December 1st 06 03:04 AM
Nested IF's with Logical Arguments - Doing something wrong here PapaDos Excel Discussion (Misc queries) 0 November 30th 06 05:13 PM
Nested IF's with Logical Arguments - Doing something wrong her Dave F Excel Discussion (Misc queries) 0 November 30th 06 04:44 PM
Wrong number of Arguments or Invalid property assignment Turin[_2_] Excel Programming 1 July 17th 05 09:52 PM


All times are GMT +1. The time now is 07:46 AM.

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

About Us

"It's about Microsoft Excel"