Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How is invalid macro name getting assigned to toolbar button???

Status
Not open for further replies.

gritz

Programmer
Apr 24, 2003
14
US
I am using Excel 97. I have a macro called CopyMultFiles that ends with a SaveAs command like this one:

ActiveWorkbook.SaveAs FileName:="ftp://someunixservername/dir1/dir2/dir3/dir4/somefilename", FileFormat:=xlTextPrinter

The macro is assigned to a button which I have added to a toolbar. My problem is that, after working successfully one time, somehow the button gets re-assigned, and the macro that gets re-assigned to it is the file name within the double quotes in the above command. Since this is not actually a macro, the next time I try to use the button, I get a message saying the macro could not be found.

What am I doing wrong?
 
gritz,

try the following:

Dim strFileName as String
strFileName = ftp://someunixservername/dir1/dir2/dir3/dir4/somefilename"

ActiveWorkbook.SaveAs FileName:= strFileName, FileFormat:=xlTextPrinter


Leigh Moore
LJM Analysis Ltd
 
I tried your suggestion, but I am still having the same problem. The button works the first time, but then the file name gets assigned to it, and it doesn't work again until I re-assign the correct macro name to the button.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top