+ Reply to Thread
Results 1 to 2 of 2

Do action Before Save

  1. #1
    Registered User
    Join Date
    07-26-2010
    Location
    Denver
    MS-Off Ver
    Excel 2007
    Posts
    2

    Do action Before Save

    I've found dozens of examples to complete an action before save such as:

    Private Sub workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Dim lReply As Long
    If SaveAsUI = True Then
    lReply = MsgBox("Do you wish to save this workbook?", vbQuestion + vbOKCancel)
    Cancel = (lReply = vbCancel)
    If Cancel = False Then Me.Save
    Cancel = True
    End If
    End Sub

    ...but when I insert this into my VBA code window and save, nothing happens. If I am reading this right, when I save the wkbk, a message should pop up, right?

    I'm terrible at VBA but I understand the logic.

    All I want to do is have an action triggered when I hit save. Is that even possible?

    Thanks

  2. #2
    Valued Forum Contributor blane245's Avatar
    Join Date
    02-20-2009
    Location
    Melbourne, FL
    MS-Off Ver
    Excel 2010
    Posts
    649

    Re: Do action Before Save

    You need to put this module in the ThisWorkbook objecrt of the VBA Project.
    Bob
    Click my star if my answer helped you. Mark the thread as [SOLVED] if it has been.

+ 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