Save file with todays date ref#11235

  • Thread starter Thread starter kremstep
  • Start date Start date
K

kremstep

Hello,

I need to save an excel file to the below directory with todays date
can anyone assist me in combining the two formulas.


Formulas to save file as todays date

ActiveWorkbook.SaveAs "Report" & Format(Now, "yyyymmdd") & ".xls"



This is the directory

Sub test3()
'
' test3 Macro
' Macro recorded 1/29/2009 by ME
'

'
ActiveWorkbook.SaveAs Filename:= _
"\\Wnccteav4\CCVOL4\MFC\SHARED\GSAM\Macro Database\Currency
Imbalance\Imbalance database\For 01.30.09.xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
End Sub
 
Option Explicit
Sub test3()
dim myFileName as string
Dim myPath as string

'make sure you include the last backslash!
myPath = "\\Wnccteav4\CCVOL4\MFC\SHARED\GSAM\Macro Database\" _
& "Currency Imbalance\Imbalance database\"

myFilename = "Report" & Format(date, "yyyymmdd") & ".xls"

ActiveWorkbook.SaveAs Filename:=myPath & myfilename, _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

End Sub
 
Construct your file name string first like this

FName="\\Wnccteav4\CCVOL4\MFC\SHARED\GSAM\Macro Database\Currency
Imbalance\Imbalance database\Report" & Format(Now, "yyyymmdd") & ".xls"

Then use it in the Save line

ActiveWorkbook.SaveAs Filename:= _
FName, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
 
Back
Top