![]() |
Appending filename with date
I have a macro that runs an application, and creates new files with the results. I want to have the date (and if possible time) of the run in my file name. But I am not able to do this with the Date function as I guess the results it throws is not in the text format. How can I do this in VB? Right now, to do this, I am typing the date in "" in one of the cellls, but I am sure there would be better ways. Suggestions please. Thanks, Kapil -- kapil.dalal ------------------------------------------------------------------------ kapil.dalal's Profile: http://www.excelforum.com/member.php...o&userid=23853 View this thread: http://www.excelforum.com/showthread...hreadid=375005 |
Appending filename with date
Use in VBA myVar = Format(Now(), "dd mmm yy") Mangesh -- mangesh_yadav ------------------------------------------------------------------------ mangesh_yadav's Profile: http://www.excelforum.com/member.php...o&userid=10470 View this thread: http://www.excelforum.com/showthread...hreadid=375005 |
Appending filename with date
sFilename = "myFile-" & Format(Now,"yyyymmdd hhmmss") & ".xls" -- HTH Bob Phillips "kapil.dalal" wrote in message ... I have a macro that runs an application, and creates new files with the results. I want to have the date (and if possible time) of the run in my file name. But I am not able to do this with the Date function as I guess the results it throws is not in the text format. How can I do this in VB? Right now, to do this, I am typing the date in "" in one of the cellls, but I am sure there would be better ways. Suggestions please. Thanks, Kapil -- kapil.dalal ------------------------------------------------------------------------ kapil.dalal's Profile: http://www.excelforum.com/member.php...o&userid=23853 View this thread: http://www.excelforum.com/showthread...hreadid=375005 |
Appending filename with date
Thanks a lot. It works. -- kapil.dalal ------------------------------------------------------------------------ kapil.dalal's Profile: http://www.excelforum.com/member.php...o&userid=23853 View this thread: http://www.excelforum.com/showthread...hreadid=375005 |
Appending filename with date
Thanks for the feedback Manges -- mangesh_yada ----------------------------------------------------------------------- mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047 View this thread: http://www.excelforum.com/showthread.php?threadid=37500 |
Appending filename with date
This link might give you some ideas:
http://www.bygsoftware.com/Excel/VBA/saving.htm -- Andy Wiggins FCCA www.BygSoftware.com Excel, Access and VBA Consultancy Home of Excel Save and Backup - "kapil.dalal" wrote in message ... I have a macro that runs an application, and creates new files with the results. I want to have the date (and if possible time) of the run in my file name. But I am not able to do this with the Date function as I guess the results it throws is not in the text format. How can I do this in VB? Right now, to do this, I am typing the date in "" in one of the cellls, but I am sure there would be better ways. Suggestions please. Thanks, Kapil -- kapil.dalal ------------------------------------------------------------------------ kapil.dalal's Profile: http://www.excelforum.com/member.php...o&userid=23853 View this thread: http://www.excelforum.com/showthread...hreadid=375005 |
All times are GMT +1. The time now is 12:23 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com