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 sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to Save a Workbook

Status
Not open for further replies.

amecari

Technical User
Mar 21, 2001
29
BR
Hi,
I neede some help with this: I have a plan.xls and I need to save thie in this directory "e:\temp" and the name of file to save is wrote in a cell F6.

Sub Save

Dim name as string
Name = Worksheets("Example").Range("F" & 6).Value
ActiveWorkbook.SaveAs Filename:="e:\tmp\NAME"

End Sub
But the variable NAME ins't recognized. I have in e:\temp a file named NAME.XLS, inside for example DOOR thats is in cell F6.
Someone could help me ???
Thanks a lot
 
First, you should not use the variable name NAME. I believe it is reserved.
Code:
Dim sFileName as string
sFileName = Worksheets("Example").Range("F" & 6).Value
ActiveWorkbook.SaveAs Filename:="E:\tmp\" & sFileName
 
DSI, thanks very much.
You did resolve my problem. I didn"t kown how to "load" a variable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top