+ Reply to Thread
Results 1 to 3 of 3

Running a macro "On Save"

  1. #1
    Registered User
    Join Date
    01-17-2006
    Posts
    46

    Question Running a macro "On Save"

    Hi,

    Can anyone tell me how I can get a file to run a macro each time the file is saved. I know this is achievable but can't find how to do it.

    Thanks in advance for any assistance.

  2. #2
    papou
    Guest

    Re: Running a macro "On Save"

    Hello
    Use this workbook event which fires before saving workbook :
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    Boolean)
    If Not Cancel Then
    'do your stuff here
    End If
    End Sub

    To acces this event either right-click on the Excel icon immediately
    situated left to th File Menu in Excel
    or open VB Editor and double-click on Thisworkbook

    HTH
    Cordially
    Pascal

    "heski" <[email protected]> a écrit dans le
    message de news: [email protected]...
    >
    > Hi,
    >
    > Can anyone tell me how I can get a file to run a macro each time the
    > file is saved. I know this is achievable but can't find how to do it.
    >
    > Thanks in advance for any assistance.
    >
    >
    > --
    > heski
    > ------------------------------------------------------------------------
    > heski's Profile:
    > http://www.excelforum.com/member.php...o&userid=30581
    > View this thread: http://www.excelforum.com/showthread...hreadid=543201
    >




  3. #3
    CLR
    Guest

    RE: Running a macro "On Save"


    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Application.Run "PutYourMacroNameHere"
    End Sub

    Vaya con Dios,
    Chuck, CABGx3


    "heski" wrote:

    >
    > Hi,
    >
    > Can anyone tell me how I can get a file to run a macro each time the
    > file is saved. I know this is achievable but can't find how to do it.
    >
    > Thanks in advance for any assistance.
    >
    >
    > --
    > heski
    > ------------------------------------------------------------------------
    > heski's Profile: http://www.excelforum.com/member.php...o&userid=30581
    > View this thread: http://www.excelforum.com/showthread...hreadid=543201
    >
    >


+ 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