ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Saving file using data from worksheet (https://www.excelbanter.com/excel-programming/342644-saving-file-using-data-worksheet.html)

Patrick Simonds

Saving file using data from worksheet
 
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



Norman Jones

Saving file using data from worksheet
 
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

---
Regards,
Norman



"Patrick Simonds" wrote in message
...
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





All times are GMT +1. The time now is 06:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com