ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Save or open file as YYYYMMDD in Macros, how to record it (https://www.excelbanter.com/excel-discussion-misc-queries/108374-save-open-file-yyyymmdd-macros-how-record.html)

Vijay Kotian

Save or open file as YYYYMMDD in Macros, how to record it
 
In Macros, I would like to save or open file name as YYYYMMDD or pickup name
from a cell where date is mentioned as =today() with format as YYYYMMDD. or
any other alternative to pick up the file with naming convention as mentioned
above.

Dave Peterson

Save or open file as YYYYMMDD in Macros, how to record it
 
Activeworkbook.saveas filename:=format(date,"yyyymmdd") & ".xls", _
fileformat:=xlworkbooknormal

Is one way to save a workbook with today's date. I didn't give it a folder
location--so it'll save to the current folder (whatever that might be!).

dim wkbk as workbook
set wkbk = workbooks.open(filename:=format(date,"yyyymmdd") & ".xls")

would be a way to open a workbook in the current folder that has today's date as
the name.

Vijay Kotian wrote:

In Macros, I would like to save or open file name as YYYYMMDD or pickup name
from a cell where date is mentioned as =today() with format as YYYYMMDD. or
any other alternative to pick up the file with naming convention as mentioned
above.


--

Dave Peterson


All times are GMT +1. The time now is 07:10 PM.

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