Article ID: 141512
Article Last Modified on 10/11/2006
Sub SaveWithVariable()
MyFile = ActiveWorkbook.Name
' Do not display the message about overwriting the existing file.
Application.DisplayAlerts = False
' Save the active workbook with the name of the
' active workbook. Save it on the E drive to a folder called
' "User" with a subfolder called "JoeDoe."
ActiveWorkbook.SaveAs Filename:="E:\User\JoeDoe\" & MyFile
' Close the workbook by using the following.
ActiveWorkbook.Close
End Sub
NOTE: In Microsoft Excel for the Macintosh, the path used to save the file
might resemble the following
ActiveWorkbook.SaveAs FileName:="User:JoeDoe:" & MyFile
Sub SaveWithVariableFromCell()
SaveName = ActiveSheet.Range("A1").Text
ActiveWorkbook.Close Filename:="E:\User\JoeDoe\" & SaveName & ".xls"
End Sub
Additional query words: 8.00 XL98 XL97 XL7 XL5 XL
Keywords: kbdtacode kbhowto kbprogramming KB141512