Export to be named using current date time stamp

G

Guest

I have an application that exports files to a customer. The customer wants
the app to be run serveral times a day so we will need to add a time stamp to
the date stamp already in place.

I tried to use this.
strNewFileName = sAppPath & "DDPPOP-" & Format(Now(), "mm-dd-
yyyy_hh:m:ss_AM/PM") & ".csv"

strNewFileName = Replace(strNewFileName, ":", ".")

I got an error Path Not Found. I think it's because it removed the : out of
the C:\
part of the path. is there a format for a time stamp that does not include
colons?
 
V

Van T. Dinh

If I need something like that, I just include YYYYMMDDHHMM in the file name
without any puctuation marks. This should do:

Format(Now(), "YYYYMMDDHHnn")

Microsoft uses the same convention also, e.g. SQL Server back-up files.
 

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