Macro to save to LAN using cell reference for file name.
Posted by Gary Hewitt-Long on November 14, 2001 11:01 AM
Hi,
anyone know how to change this macro? I am trying to save a file to another computer on a network naming it with the contents of sheet NAME!A1 which happens to be the date (month and year).
When I run the macro it will only save it in the same directory as the original file.
Sub archive()
'
' archive Macro
' Macro recorded 14/11/01 by Gary Hewitt-Long
'
'
Windows("SECONDS.xls").Activate
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveWorkbook.Save
ChDir "\\Lisa\c\Seconds_archive"
ActiveWorkbook.SaveAs FileName:="\\Lisa\c\Seconds_archive\SECONDS.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ThisFile = Range("NAME!A1").Value
ActiveWorkbook.SaveAs FileName:=ThisFile, FileFormat _
:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
ActiveWorkbook.Close
ChDir "C:\Steve\Steve Share"
Workbooks.Open FileName:="C:\Steve\Steve Share\SECONDS.xls"
End Sub
By the way I tried in the above macro to save the file first, then save under the original name on the LAN computer, close the file, then open the file and then save, but it still saves in the original directory of the original file, that the macro was run in to begin with, AAAARRRRGGGGHHH.
Hope someone can help.
Regards,
Gary Hewitt-Long