Add the current date to the report before exporting

  • Thread starter Thread starter D
  • Start date Start date
D

D

I am exporting a daily report to a specific folder; the latest one is
overwriting the previous one.

Can you please tell me hotw do I add the today's date to the current report
in order to keep a history of all of them; instead of overwriting???

Thanks a lot!

Dan

Dan
 
Dan,
here is code I use to add the date to an export.

the public function lives in a class module

Public Function CurrDate() As String

CurrDate = Format(Date, "dd-mm-yyyy")

End Function

Here is code I use to add the current date when I am exporting to excel
strFileNameEnd = CurrDate & ".xls"

I build the file name in code then add strFileNameEnd to the nearly complete
file name.

If you already have a file name,
you would need to add the CurrDate between the end of the file name but
before the extension.

Jeanette Cunningham
 
Thanks a lot Jeanette!

Dan

Jeanette Cunningham said:
Dan,
here is code I use to add the date to an export.

the public function lives in a class module

Public Function CurrDate() As String

CurrDate = Format(Date, "dd-mm-yyyy")

End Function

Here is code I use to add the current date when I am exporting to excel
strFileNameEnd = CurrDate & ".xls"

I build the file name in code then add strFileNameEnd to the nearly complete
file name.

If you already have a file name,
you would need to add the CurrDate between the end of the file name but
before the extension.

Jeanette Cunningham
 
Back
Top