+ Reply to Thread
Results 1 to 3 of 3

Simple Msgbox needed

  1. #1
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462

    Simple Msgbox needed

    Hello, I am looking for a simple msgbox which will pop up if there is nothing in a certain cell and ask the user if he wants to continue the macro. If he clicks Yes then code continues otherwise it stops.

    After looking in the VB help it only shows the following code but it seems far too messy for what I need. Can anyone help with a simpler version please.

    -----------
    Dim Msg, Style, Title, Help, Ctxt, Response, MyString
    Msg = "Do you want to continue ?" ' Define message.
    Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
    Title = "MsgBox Demonstration" ' Define title.
    Help = "DEMO.HLP" ' Define Help file.
    Ctxt = 1000 ' Define topic
    ' context.
    ' Display message.
    Response = MsgBox(Msg, Style, Title, Help, Ctxt)
    If Response = vbYes Then ' User chose Yes.
    MyString = "Yes" ' Perform some action.
    Else ' User chose No.
    MyString = "No" ' Perform some action.
    End If
    --------------

  2. #2
    Norman Jones
    Guest

    Re: Simple Msgbox needed

    Hi John,

    '=============>>
    Public Sub TesterD001()
    Dim res As Long

    res = MsgBox("Do you wish to continue", vbYesNo)

    If res = vbYes Then
    ' Your processing code
    End If

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

    ---
    Regards,
    Norman



    "johncassell" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > Hello, I am looking for a simple msgbox which will pop up if there is
    > nothing in a certain cell and ask the user if he wants to continue the
    > macro. If he clicks Yes then code continues otherwise it stops.
    >
    > After looking in the VB help it only shows the following code but it
    > seems far too messy for what I need. Can anyone help with a simpler
    > version please.
    >
    > -----------
    > Dim Msg, Style, Title, Help, Ctxt, Response, MyString
    > Msg = "Do you want to continue ?" ' Define message.
    > Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
    > Title = "MsgBox Demonstration" ' Define title.
    > Help = "DEMO.HLP" ' Define Help file.
    > Ctxt = 1000 ' Define topic
    > ' context.
    > ' Display message.
    > Response = MsgBox(Msg, Style, Title, Help, Ctxt)
    > If Response = vbYes Then ' User chose Yes.
    > MyString = "Yes" ' Perform some action.
    > Else ' User chose No.
    > MyString = "No" ' Perform some action.
    > End If
    > --------------
    >
    >
    > --
    > johncassell
    > ------------------------------------------------------------------------
    > johncassell's Profile:
    > http://www.excelforum.com/member.php...o&userid=25016
    > View this thread: http://www.excelforum.com/showthread...hreadid=515260
    >




  3. #3
    Forum Contributor
    Join Date
    07-07-2005
    Location
    England
    MS-Off Ver
    Office 2019 Enterprise
    Posts
    462
    Cheers for that Norman, looks much neater.

    Thanks again

    John

+ 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