+ Reply to Thread
Results 1 to 7 of 7

"If Yes then Proceed..." Macro

  1. #1
    bman342
    Guest

    "If Yes then Proceed..." Macro

    I need a simple Yes/No dialog box.
    If the User clicks "Yes" it runs a macro that I have already recorded.
    If "No" it closes the macro.

    Is there a trusted public library of these types of basic macros somewhere?

    Thanks so much.

  2. #2
    Norman Jones
    Guest

    Re: "If Yes then Proceed..." Macro

    Hi Bman342,

    Try:

    '=============>>
    Public Sub Tester()
    Dim res As VbMsgBoxResult

    res = MsgBox(Prompt:="Do you wish to run the Macro?", _
    Buttons:=vbYesNo + vbQuestion)

    If res = vbNo Then Exit Sub

    'Your code

    End Sub
    '<<=============


    ---
    Regards,
    Norman



    "bman342" <[email protected]> wrote in message
    news:[email protected]...
    >I need a simple Yes/No dialog box.
    > If the User clicks "Yes" it runs a macro that I have already recorded.
    > If "No" it closes the macro.
    >
    > Is there a trusted public library of these types of basic macros
    > somewhere?
    >
    > Thanks so much.




  3. #3
    Ardus Petus
    Guest

    Re: "If Yes then Proceed..." Macro

    dim vRep as Variant
    vRep = Msgbox("Do you want to continue",vbYesNo)
    if vRep = vbYes then
    <do something>
    end if

    HTH
    --
    AP

    "bman342" <[email protected]> a écrit dans le message de
    news: [email protected]...
    >I need a simple Yes/No dialog box.
    > If the User clicks "Yes" it runs a macro that I have already recorded.
    > If "No" it closes the macro.
    >
    > Is there a trusted public library of these types of basic macros
    > somewhere?
    >
    > Thanks so much.




  4. #4
    Norman Jones
    Guest

    Re: "If Yes then Proceed..." Macro

    Hi Bman342,

    Alternatively, try:

    '=============>>
    Public Sub Tester()
    Dim res As VbMsgBoxResult

    res = MsgBox(Prompt:="Do you wish to run the Macro?", _
    Buttons:=vbYesNo + vbQuestion)

    If res = vbYes Then
    Call myMacro
    End If

    End Sub
    '<<=============


    ---
    Regards,
    Norman


    "bman342" <[email protected]> wrote in message
    news:[email protected]...
    >I need a simple Yes/No dialog box.
    > If the User clicks "Yes" it runs a macro that I have already recorded.
    > If "No" it closes the macro.
    >
    > Is there a trusted public library of these types of basic macros
    > somewhere?
    >
    > Thanks so much.




  5. #5
    bman342
    Guest

    Re: "If Yes then Proceed..." Macro

    Works fine. Much thanks to both.

    "Norman Jones" wrote:

    > Hi Bman342,
    >
    > Alternatively, try:
    >
    > '=============>>
    > Public Sub Tester()
    > Dim res As VbMsgBoxResult
    >
    > res = MsgBox(Prompt:="Do you wish to run the Macro?", _
    > Buttons:=vbYesNo + vbQuestion)
    >
    > If res = vbYes Then
    > Call myMacro
    > End If
    >
    > End Sub
    > '<<=============
    >
    >
    > ---
    > Regards,
    > Norman
    >
    >
    > "bman342" <[email protected]> wrote in message
    > news:[email protected]...
    > >I need a simple Yes/No dialog box.
    > > If the User clicks "Yes" it runs a macro that I have already recorded.
    > > If "No" it closes the macro.
    > >
    > > Is there a trusted public library of these types of basic macros
    > > somewhere?
    > >
    > > Thanks so much.

    >
    >
    >


  6. #6
    witek
    Guest

    Re: "If Yes then Proceed..." Macro

    bman342 wrote:
    > I need a simple Yes/No dialog box.
    > If the User clicks "Yes" it runs a macro that I have already recorded.
    > If "No" it closes the macro.
    >
    > Is there a trusted public library of these types of basic macros somewhere?
    >
    > Thanks so much.



    if MsgBox ("Message", vbYesNo) = vbYes then

    .... macro

    end if

  7. #7
    Moose
    Guest

    Re: "If Yes then Proceed..." Macro


    bman342 wrote:
    > I need a simple Yes/No dialog box.
    > If the User clicks "Yes" it runs a macro that I have already recorded.
    > If "No" it closes the macro.
    >
    > Is there a trusted public library of these types of basic macros somewhere?
    >
    > Thanks so much.


    Try This:

    Msg = MsgBox("Your Question For User",vbYesNo,)
    If Msg = vbNo Then Exist Sub
    If Msg = vbYes Then Your Macro


+ 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