Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default how to name filename with date in macro

I have a macro that saves off a copy of a file. i would like to put a date
stamp and/or possibly a time stamp on the filename. Is there anyway of doing
this? thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default how to name filename with date in macro

From a recent posting of mine.

Goto the small excel icon in the upper left of the screen next to Fileright
clickinsert this.
For today, you will get aaa20071116

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
Dim mydate As String
Application.DisplayAlerts = False
mydate = Format(Date, "yyyymmdd")
SaveAs Filename:="aaa" & mydate & ".xls"
Application.DisplayAlerts = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Daniel M" wrote in message
...
I have a macro that saves off a copy of a file. i would like to put a date
stamp and/or possibly a time stamp on the filename. Is there anyway of
doing
this? thanks.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
set filename to <filename-date on open bob engler Excel Worksheet Functions 2 July 13th 06 05:11 AM
set excel <filename to <filename-date bob engler Excel Programming 2 July 12th 06 08:22 AM
Date Filename Save as Dialog Macro Thingy!!!!!! Cobbcouk[_2_] Excel Programming 2 March 31st 06 06:46 AM
Macro Filename as Date Donkin[_5_] Excel Programming 3 June 3rd 05 02:46 PM
Inserting Date In Filename Using Macro Mega_-__ Excel Programming 2 November 27th 03 08:51 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"