ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Putting Data & Time in file name (https://www.excelbanter.com/excel-programming/333926-putting-data-time-file-name.html)

rglasunow[_24_]

Putting Data & Time in file name
 

I would like to add the time to the file name along with the date that I
currently have in the file name.

I currently have the date in the code below in bold. How can I add the
current time as well?

ActiveWorkbook.SaveAs Filename:="C:\SOS Data\Compiled Data\SOS Data - "
*& Format(Date, "mm-dd-yyyy") &* ".xls"

Thanks ya'll!!!


--
rglasunow
------------------------------------------------------------------------
rglasunow's Profile: http://www.excelforum.com/member.php...fo&userid=4212
View this thread: http://www.excelforum.com/showthread...hreadid=385436


Damon Longworth

Putting Data & Time in file name
 
Try:

Format(Date, "mm-dd-yyyy hhmmss")

--
Damon Longworth

Don't miss out on the 2005 Excel User Conference
Sept 16th and 17th
Stockyards Hotel - Ft. Worth, Texas
www.ExcelUserConference.com


"rglasunow" wrote
in message ...

I would like to add the time to the file name along with the date that I
currently have in the file name.

I currently have the date in the code below in bold. How can I add the
current time as well?

ActiveWorkbook.SaveAs Filename:="C:\SOS Data\Compiled Data\SOS Data - "
*& Format(Date, "mm-dd-yyyy") &* ".xls"

Thanks ya'll!!!


--
rglasunow
------------------------------------------------------------------------
rglasunow's Profile:
http://www.excelforum.com/member.php...fo&userid=4212
View this thread: http://www.excelforum.com/showthread...hreadid=385436




rglasunow[_25_]

Putting Data & Time in file name
 

Unfortunately that did not work. The only thing it did was add 6 zero
after the date. I also tried hh:mm:ss and that didn't work either.
Any other suggestions in putting the current time into the file name?

thanks again

--
rglasuno
-----------------------------------------------------------------------
rglasunow's Profile: http://www.excelforum.com/member.php...nfo&userid=421
View this thread: http://www.excelforum.com/showthread.php?threadid=38543


Norie

Putting Data & Time in file name
 

Instead of date use Now.

Code
-------------------

Format(Now, "mm-dd-yyyy hhmmss"
-------------------

--
Nori
-----------------------------------------------------------------------
Norie's Profile: http://www.excelforum.com/member.php...fo&userid=1936
View this thread: http://www.excelforum.com/showthread.php?threadid=38543



All times are GMT +1. The time now is 02:36 PM.

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