View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Save File with Date and Time Stamp

Dim mySuffix as string
mysuffix = format(now,"yyyy_mm_dd-hhmmss") & ".xls"

I think???

Curt D. wrote:

How would I properly insert the underscore (_). When it saves it saves like
20060503-2006_05_03-162230.xls
this is how I have it written, how can I change it to save like
2006_05_03-162230.xls

With ActiveWorkbook
.SaveAs Left(ActiveWorkbook.FullName, _
InStr(1, ActiveWorkbook.FullName, "-")) _
& Format(Now, "yyyy(_)mm(_)dd-hhmmss") & ".xls"
End With

"Dave Peterson" wrote:

Windows won't allow colons in the file name.

I use the underscore (_) as a separator if I really want one.

Chuckles123 wrote:

Is it possible to include a ":" between "the hour" and "the minute" in a
time stamp used as part of a filename (file to be saved by VBA code)?
Normally, VBA will not allow this.

Thanks for a response,
Chuckles123

--
Chuckles123
------------------------------------------------------------------------
Chuckles123's Profile: http://www.excelforum.com/member.php...o&userid=14948
View this thread: http://www.excelforum.com/showthread...hreadid=380389


--

Dave Peterson


--

Dave Peterson