Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How not to delete/overlay a saved spreadsheet.

Status
Not open for further replies.

cassidybklyn

Programmer
Apr 23, 2007
82
US
Hello everyone.
I generated an excel spreadsheet from vb and saved it to my local drive, but I want to append today's date and time to the file:
example:

xlWbk.SaveAs("myspreadsheet_05/09/2007_00:00:00.xls")

The next time I generate this same spreadsheet, I do not want to overlay the previous one; I want to save it also, and so on......

What vb6 code can I use to get this done.
Thanks.
C.
 

xlWbk.SaveAs "c:\myspreadsheet_" & Format (Now(), "yyyy-mm-dd_hhnnss") & ".xls"

You cant use these characters in filenames \ / : * ? < > | '
 
how about
xlWbk.SaveAs("myspreadsheet_"&Format(Now(), "dd/mm/yy_hh:mm:ss"))

obviously change the format picture to suit!


;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
just realised stupid error in what i said and now see that it was pointed out before my rely appeared!!

no / or : allowed! [blush]

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
Thanks guys. "Bone-head" me; I figured out that if I embed and format the date and time to the seconds, Like: & date & time, each time the file is saved, it will always be different.
Thnx y'all.
C.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top