I'm using some VB to take and excel file and save it as a csv. Part of the logic put the date in the file name
DateTime = Format(CStr(Now), "yyyymmddhhmmss")
SaveCSV = "fq_DeliveredPrice_Petrocard_haz_" & DateTime & ".csv"
fname = ThisWorkbook.Path & "\" & SaveCSV
It was working great but now they want to run it a day earlier, which means I need to name the file with tomorrows date.
I messed around and think I have something that works. Or should I say, it works now but I am worried that at the end of the month it won't roll over the month.
Can anyone tell me if this code will make the date 20110801 when they save it on 20110731 and not make it 20110732?
Today = Format(CStr(Now), "yyyymmdd") + 1
Time = Format(CStr(Now), "hhmmss")
SaveCSV = "fq_DeliveredPrice_Petrocard_haz_" & Today & Time & ".csv"
fname = ThisWorkbook.Path & "\" & SaveCSV
DateTime = Format(CStr(Now), "yyyymmddhhmmss")
SaveCSV = "fq_DeliveredPrice_Petrocard_haz_" & DateTime & ".csv"
fname = ThisWorkbook.Path & "\" & SaveCSV
It was working great but now they want to run it a day earlier, which means I need to name the file with tomorrows date.
I messed around and think I have something that works. Or should I say, it works now but I am worried that at the end of the month it won't roll over the month.
Can anyone tell me if this code will make the date 20110801 when they save it on 20110731 and not make it 20110732?
Today = Format(CStr(Now), "yyyymmdd") + 1
Time = Format(CStr(Now), "hhmmss")
SaveCSV = "fq_DeliveredPrice_Petrocard_haz_" & Today & Time & ".csv"
fname = ThisWorkbook.Path & "\" & SaveCSV