I am Trying to use this comand to rename and relocate a file using a macro. If I do this it works.
ActiveWorkbook.SaveAs Filename:= _
"P:\PHX Station\Station Supervisors\Ramp Schedule\Weekly Ramp Schedule3-31-02 to 3-15-02.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
But I would like the location and file name to be in a variable I call strNewLoc. I can't get it to work at all. It tells me that ithe file is in use or doesn't exist. Run time error 1004. Below is the code that won't work. datEnd and datStart are dimed as date.
strNewLoc = "P:\PHX Station\Station Supervisors\Ramp Schedule\Ramp Schedule" & " " & datStart & "-" & datEnd & ".xls"
ActiveWorkbook.SaveAs Filename:= _
strNewLoc _
, FileFormat:=xlNormal, Password:="",WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ActiveWorkbook.SaveAs Filename:= _
"P:\PHX Station\Station Supervisors\Ramp Schedule\Weekly Ramp Schedule3-31-02 to 3-15-02.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
But I would like the location and file name to be in a variable I call strNewLoc. I can't get it to work at all. It tells me that ithe file is in use or doesn't exist. Run time error 1004. Below is the code that won't work. datEnd and datStart are dimed as date.
strNewLoc = "P:\PHX Station\Station Supervisors\Ramp Schedule\Ramp Schedule" & " " & datStart & "-" & datEnd & ".xls"
ActiveWorkbook.SaveAs Filename:= _
strNewLoc _
, FileFormat:=xlNormal, Password:="",WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False