+ Reply to Thread
Results 1 to 4 of 4

build a macro that saves & names a file with the current day's date

Hybrid View

  1. #1
    Registered User
    Join Date
    06-29-2007
    Posts
    18

    build a macro that saves & names a file with the current day's date

    HI,

    Is it possible to build a macro that saves a file and names it with the current day's (or month) date ? e.g. (March 08.xls, March 15, 2008.xls)

    thank you
    marius

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Quote Originally Posted by mariusescu
    HI,

    Is it possible to build a macro that saves a file and names it with the current day's (or month) date ? e.g. (March 08.xls, March 15, 2008.xls)

    thank you
    marius
    Hi,

    Yes, just put the following code in the Workbook_BeforeSave event

    ActiveWorkbook.SaveAs Filename:=Format(Date, "mmmm dd yyyy") & ".xls"

  3. #3
    Registered User
    Join Date
    10-09-2003
    Posts
    25
    I got this macro from this forum sometime back. You can modify to what you want. This macro save the current active sheet into a separate workbook with the date in the filename.

    Sub Save_Sheet_to_Individual_Workbook()
    '
    ' Create individual workbook from active sheet Macro
    '
    Dim Fname, strMessage As String
    '
    'Save active sheet as a workbook with today's date
    '
    Fname = ActiveSheet.Name & "-" & Format(Date, "ddmmmyy")
    ActiveSheet.Copy
    ActiveWorkbook.SaveAs Filename:=Fname & ".xls"
    ActiveWorkbook.Close SaveChanges:=False
    '
    ' Display saved message
    strMessage = Fname & " saved in " & vbCrLf & vbCrLf & CurDir
    MsgBox strMessage, vbInformation, "File Saved!"
    '
    End Sub

  4. #4
    Registered User
    Join Date
    06-29-2007
    Posts
    18

    Is it possible to build a macro that saves a file and names it with the current day's

    Thanks a lot guys. You're awesome. I really appreciate your help.

    Have a great day
    marius

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1