Save file with todays date ref#11235

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
 
D

Dave Peterson

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
 
P

Paul C

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top