ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   File Names (https://www.excelbanter.com/excel-programming/343653-file-names.html)

sd

File Names
 
Can I save a file named ( yesterdays date ) using a macro.


Frank[_8_]

File Names
 
Try...
ActiveWorkbook.SaveAs Filename:="C:\Documents and Settings\username\My
Documents\" & Format(Now() - 1, "yymmdd") & ".xls"

Frank

"sd" wrote:

Can I save a file named ( yesterdays date ) using a macro.



Norman Jones

File Names
 
Hi SD,

Try something like:

'=============
Sub aTester()
Dim strPath As String

'// CHANGE path to suit
strPath = "C:\Documents and Settings\" & _
"YOUR USERNAME\My Documents"

'// Or, to save to the default folder:
'strpath=application.DefaultFilePath

ActiveWorkbook.SaveAs _
Filename:=strPath _
& "\" & Format(Date - 1, "YYYYMMDD") & ".xls", _
FileFormat:=xlWorkbookNormal

End Sub
'<<=============


---
Regards,
Norman



"sd" wrote in message
oups.com...
Can I save a file named ( yesterdays date ) using a macro.





All times are GMT +1. The time now is 04:33 PM.

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