+ Reply to Thread
Results 1 to 2 of 2

Macro to continue if the operator press ok or clear content if the operator press cancel

  1. #1
    Registered User
    Join Date
    06-13-2012
    Location
    Arlington, TX
    MS-Off Ver
    Excel 2003
    Posts
    31

    Macro to continue if the operator press ok or clear content if the operator press cancel

    Hi I have one macro that make excel send an e-mail and quit but I want to add a Box with a question Are you done? if the ansewer is yes go to ActiveWorkbook.Saved = True and close excel but if I have a No the macro clear all the unloock content in all sheets and go back to the first available nun lock cell.

    On Error GoTo 0
    With Application
    .EnableEvents = True
    .ScreenUpdating = True
    End With
    Set OutMail = Nothing
    Set OutApp = Nothing
    MsgBox "Are you done with your entry?"
    ActiveWorkbook.Saved = True
    Application.Quit
    End Sub

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: Macro to continue if the operator press ok or clear content if the operator press canc

    Hi,

    This little piece of code demonstrates how to capture the response from the MsgBox:
    Please Login or Register  to view this content.
    Hope this helps

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Trying to reduce the amount of times I have to press CANCEL
    By Dave Reevell in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-14-2011, 07:01 AM
  2. How to avoid an error, if you press cancel on a SAVE FILE-Macro
    By Silas313 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-01-2010, 04:56 AM
  3. Macro Running Very Slow - Cell (press esc to cancel)
    By taylormade58 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-10-2009, 06:25 PM
  4. Resolved >>> Track if user press cancel in save as dialog box
    By abbani in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2007, 11:07 AM
  5. I keep losing my function when I press a clear button macro!
    By LtsGo4ARide in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-03-2007, 01:56 AM

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