![]() |
VB Script file save as with date
I have a daily metric where I import the data & run with Excel VB script. I'd
like have the script save this as a certain date value in the filename every day. I have tried using a cell value, then referring to ActiveWorkbook.SaveAs Filename:=ActiveCell.Value, however, I need to save it as \\server\reports\daily_market_status 2005-01-13.xls I have tried using the =today() date format in a cell and cocatenating with the active saveas cell value, but I just get the date serial number in the formula. Any hints? Thanks!! |
VB Script file save as with date
Filename:=" \\server\reports\daily_market_status\" &
Format(Date,"yyyy-mm-dd") & .xls Date is the vba equivalent of Today() in the worksheet. -- Regards, Tom Ogilvy "nixter" wrote in message ... I have a daily metric where I import the data & run with Excel VB script. I'd like have the script save this as a certain date value in the filename every day. I have tried using a cell value, then referring to ActiveWorkbook.SaveAs Filename:=ActiveCell.Value, however, I need to save it as \\server\reports\daily_market_status 2005-01-13.xls I have tried using the =today() date format in a cell and cocatenating with the active saveas cell value, but I just get the date serial number in the formula. Any hints? Thanks!! |
VB Script file save as with date
Use the format function
Format(ActiveCell.Value, "yy-mm-dd") like this " \\server\reports\daily_market_status" & " " & Format(ActiveCell.Value, "yy-mm-dd") -- Regards Ron de Bruin http://www.rondebruin.nl "nixter" wrote in message ... I have a daily metric where I import the data & run with Excel VB script. I'd like have the script save this as a certain date value in the filename every day. I have tried using a cell value, then referring to ActiveWorkbook.SaveAs Filename:=ActiveCell.Value, however, I need to save it as \\server\reports\daily_market_status 2005-01-13.xls I have tried using the =today() date format in a cell and cocatenating with the active saveas cell value, but I just get the date serial number in the formula. Any hints? Thanks!! |
VB Script file save as with date
Misread what you want the filename to be (and left the quotes off ".xls"),
so here is a modification Filename:=" \\server\reports\daily_market_status " & _ Format(Date,"yyyy-mm-dd") & ".xls" -- Regards, Tom Ogilvy "Tom Ogilvy" wrote in message ... Filename:=" \\server\reports\daily_market_status\" & Format(Date,"yyyy-mm-dd") & .xls Date is the vba equivalent of Today() in the worksheet. -- Regards, Tom Ogilvy "nixter" wrote in message ... I have a daily metric where I import the data & run with Excel VB script. I'd like have the script save this as a certain date value in the filename every day. I have tried using a cell value, then referring to ActiveWorkbook.SaveAs Filename:=ActiveCell.Value, however, I need to save it as \\server\reports\daily_market_status 2005-01-13.xls I have tried using the =today() date format in a cell and cocatenating with the active saveas cell value, but I just get the date serial number in the formula. Any hints? Thanks!! |
All times are GMT +1. The time now is 12:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com