Wrong number of arguments - Help

  • Thread starter Thread starter Les Stout
  • Start date Start date
L

Les Stout

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
 
Have you checked if there are any MISSING references in the VBIDE,
Tools>References.
 
Hi, i am sorry i do not understand what is meant by the references in
the VBIDE,
Tools>References. 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
 
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.
 
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
 
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)
 
Thanks Tom, will try in the morning, 21:25 here and time to go home.
cheers

Thanks

Les Stout
 

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

Back
Top