PDA

View Full Version : Saving file



Klartigue
08-01-2012, 06:56 AM
I have this macro to save my file as the name "Cash report (today's date)." This file is supposed to save in the location G:\Fixed Income\Cash and Debit reports but for some reason it is not saving there. Does something look wrong to you in the below code??

Sub SaveCashreport()
todaysdate = Application.InputBox("Enter Today's Date for File Name", "Today's Date")
ChDir "G:\Fixed Income\Cash and Debit reports"

ActiveWorkbook.Saveas Filename:="Cash report" + " " + "(" + todaysdate + ")" + ".xls", _
FileFormat:=xlExcel8, CreateBackup:=False

End Sub

Aflatoon
08-01-2012, 08:02 AM
Sub SaveCashreport()
todaysdate = Application.InputBox("Enter Today's Date for File Name", "Today's Date")

ActiveWorkbook.Saveas Filename:=""G:\Fixed Income\Cash and Debit reports"\Cash report" + " " + "(" + todaysdate + ")" + ".xls", _
FileFormat:=xlExcel8, CreateBackup:=False

End Sub

This assumes you enter today's date in an acceptable format (i.e. not with / in it)