Saving file using data from worksheet

  • Thread starter Thread starter Patrick Simonds
  • Start date Start date
P

Patrick Simonds

I came up with this code to save the active worksheet with a set name and
the contents of cell Y1 included in the name. But when I finish enter the
code the program highlights the word Vacation and gives me the following
error msg "Expected end of statement"

ActiveWorkbook.SaveAs Filename:= _
"O:\PT_DRIVER_SCHED\"Vacation Mark-up (PT Drivers) &
Worksheets("January").[Y1].Value", FileFormat:= _
xlNormal, Password:="", WriteResPassword:="",
ReadOnlyRecommended:=False _
, CreateBackup:=True
 
Hi Patrick,

Try changing your quotes:

ActiveWorkbook.SaveAs Filename:= _
"O:\PT_DRIVER_SCHED\Vacation Mark-up (PT Drivers)" _
& Worksheets("January").[Y1].Value, _
FileFormat:=xlNormal, Password:="", _
WriteResPassword:="", _
ReadOnlyRecommended:=False, _
CreateBackup:=True
 
Back
Top