+ Reply to Thread
Results 1 to 4 of 4

Auto Save

  1. #1
    Forum Contributor
    Join Date
    10-23-2003
    Posts
    141

    Auto Save

    Hi,

    Does anyone have any suggestionsfor a Macro that would save the current workbook with the file name-prior month/year.

    For example this month (August) the file would be saved as:

    Expenses July 2005.xls

    Next month (September)

    Expenses August 2005.xls

    Thanks for your help!

  2. #2
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    Here is a macro that should do what you want.

    Sub SaveAsLastMonth()
    Dim LastMonth As String, ThisYear As String
    If Month(Date) = 1 Then
    LastMonth = "December"
    ThisYear = Year(Date) - 1
    Else
    LastMonth = MonthName(Month(Date) - 1)
    ThisYear = Year(Date)
    End If
    ActiveWorkbook.SaveAs ("Expenses " & LastMonth & " " & ThisYear & ".xls")
    End Sub

    enjoy

  3. #3
    STEVE BELL
    Guest

    Re: Auto Save

    Steve,

    Found this interesting function...

    filen = "Expenses " & Format(DateAdd("m", -1, Date), "mmmm yyyy")

    use filen in your save-as code.

    --
    steveB

    Remove "AYN" from email to respond
    "STEVEB" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi,
    >
    > Does anyone have any suggestionsfor a Macro that would save the current
    > workbook with the file name-prior month/year.
    >
    > For example this month (August) the file would be saved as:
    >
    > Expenses July 2005.xls
    >
    > Next month (September)
    >
    > Expenses August 2005.xls
    >
    > Thanks for your help!
    >
    >
    > --
    > STEVEB
    > ------------------------------------------------------------------------
    > STEVEB's Profile:
    > http://www.excelforum.com/member.php...fo&userid=1872
    > View this thread: http://www.excelforum.com/showthread...hreadid=391980
    >




  4. #4
    Forum Contributor
    Join Date
    10-23-2003
    Posts
    141
    Thanks bhofsetz & Steve Bell

    Both suggestions worked great! I really appreciate your help! It saves me alot of time.

+ 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