ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save As Function (https://www.excelbanter.com/excel-programming/352346-save-function.html)

Hlewis

Save As Function
 
I am trying to create code that will save a workbook based on a date in a
cell on a sheet within the workbook. I have started the code but VB doesn't
like it. See below:
ActiveWorkbook.Save
Sheets("Schedule").Select
ActiveWorkbook.SaveAs Filename:= _
"T:\Period End Schedules\Inventory Account Schedules\Inventory
Obsolescence\Schedule\" & Month("A2") & "/" & Day("A2") & "/" & Year("A2") &
".xls", FileFormat:=xlNormal, Password:="", WriteResPassword:="Password", _
ReadOnlyRecommended:=False, CreateBackup:=True

End Sub

The problem I am having is that the code bombs at the SaveAs command. How
do I get around this?
--
Hlewis

Helmut Weber[_2_]

Save As Function
 
Hi,

a slash "/" is not a valid character in a filename.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"


All times are GMT +1. The time now is 03:22 AM.

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