Results 1 to 5 of 5

Thread: excel

  1. #1
    abes
    Guest

    excel

    for excel 2000 -i want to write a macro that after performing all the necessary steps "saves as" a monthly report with the name of the (previous) month.
    how do I do this?

  2. #2
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: excel

    This will put the name of the previous month into the variable strMonth:

    <pre>Dim strMonth As String
    strMonth = Format(DateSerial(Year(Now()), Month(Now()) - 1, Day(Now())), "mmmm")
    </pre>

    Legare Coleman

  3. #3
    abes
    Guest

    Re: excel

    <img src=/S/blush.gif border=0 alt=blush width=15 height=15> and how do you put the variable into the save as command?

  4. #4
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: excel

    <pre>Dim strMonth As String, strFileName As String
    strMonth = Format(DateSerial(Year(Now()), Month(Now()) - 1, Day(Now())), "mmmm")
    strFileName = "C:Work" & strMonth & ".xls"
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs strFileName
    Application.DisplayAlerts = True
    </pre>

    Legare Coleman

  5. #5
    abes
    Guest

    Re: excel

    great
    thanx alot

Posting Permissions

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