View Single Post
  #2   Report Post  
Bernie Deitrick
 
Posts: n/a
Default Open an Excel file with a date as today in a macro

Perry,

When you use the file name, create it using the Format function:

Dim myFileName As String
myFileName = "Daily_Report_Perry_" & Format(Now, "dd-mm-yyyy") & ".xls"
MsgBox myFileName

Then use the variable myFileName wherever you were using the name string.

HTH,
Bernie
MS Excel MVP


"Perry" wrote in message
oups.com...
Hello,

I'm creating a daily report with certain data.

One of the steps to create this report is the input of certain data
from one Excel file into another. The destination file for this data is
an Excel file which always has a name as follows:

--- Daily_Report_Perry_dd-mm-yyyy.xls

How do I create a macro which always opens the file above with the
"today" date? By example today, wednesday the 9th of November, the
following file should be opened:

--- Daily_Report_Perry_09-11-2005.xls