ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automatic Date Stamping (https://www.excelbanter.com/excel-programming/408828-automatic-date-stamping.html)

Risky Dave

Automatic Date Stamping
 
Hi,

I have a macro that works out of an XL file which populates a Word template
with charts.

The macro then saves the template with a new name, using:

With WDDoc
.SaveAs ("C:\MyReport.doc")
End With

Is it possible to save the file with a custom date stamp (yyddmm) so that
the file would be called something like "080404 MyReport.doc"

I can then run the report the next day to produce 080405 MyReport.doc and so
on.

TIA

Dave


Ivyleaf

Automatic Date Stamping
 
On Apr 5, 12:01*am, Risky Dave
wrote:
Hi,

I have a macro that works out of an XL file which populates a Word template
with charts.

The macro then saves the template with a new name, using:

With WDDoc
* * * * .SaveAs ("C:\MyReport.doc")
* * End With

Is it possible to save the file with a custom date stamp (yyddmm) so that
the file would be called something like "080404 MyReport.doc"

I can then run the report the next day to produce 080405 MyReport.doc and so
on.

TIA

Dave


Hi Dave,

You almost answered your own question! Just change

.SaveAs ("C:\MyReport.doc")

to

.SaveAs ("C:\" & Format(Date(),"yyddmm") & " MyReport.doc")

Cheers,
Ivan.


All times are GMT +1. The time now is 01:18 AM.

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