ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Wrong number of arguments - Help (https://www.excelbanter.com/excel-programming/342445-wrong-number-arguments-help.html)

Les Stout[_2_]

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 ***

Bob Phillips[_6_]

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 ***




Les Stout[_2_]

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 ***

Tom Ogilvy

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 ***




Les Stout[_2_]

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 ***

Tom Ogilvy

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 ***




Les Stout[_2_]

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 ***


All times are GMT +1. The time now is 02:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com