Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Running a macro on Save command

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    England
    Posts
    212
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Is there any code which will allow me to run a macro each time a workbook is saved? Hope someone can help.

    Thanks

    Matt

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Christchurch New Zealand
    Posts
    1,030
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)

    End Sub
    put that code in your this workbook
    sheet in project explorer

    [ This Message was edited by: brettvba on 2002-04-16 13:33 ]

  3. #3
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Alt+F11 to access VBA. The left of the screen you will find the project explorer. Double click on ThisWorkbook. Then at the right you will see a big blank sheet. At the top of that sheet you will see a dropdown box titled General. Click on it and select Workbook. Then click the dropdown box to the right that should say Open and select BeforeSave. Enter in the code you want that will occur before a save.
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Location
    England
    Posts
    212
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Perfect! Thanks for your quick response guys.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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