• Is there a boolean equivalent to InputBox? (VBA Word 2000)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » Is there a boolean equivalent to InputBox? (VBA Word 2000)

    Author
    Topic
    #374523

    Is there a boolean equivalent to InputBox?

    I just need a simple Yes or No. I know I can create a form to do this, but wondered if there was some simple builtin box like InputBox.

    Thanks!!
    Troy

    Viewing 0 reply threads
    Author
    Replies
    • #606032

      You can use MsgBox:

      If MsgBox(“Do you really want to do this”, vbQuestion + vbYesNo) = vbYes Then
      ‘ Perform actions for Yes
      Else
      ‘ Perform actions for No
      End If

      The second argument to MsgBox can be a combination of several parts:

      • The icon to display:
        vbCritical Stop sign
        vbExclamation Exclamation mark
        vbInformation Information sign
        vbQuestion Question mark
      • The buttons to display:
        vbAbortRetryIgnore Abort, Retry and Ignore buttons
        vbOKCancel OK and Cancel buttons
        vbOKOnly OK button (default, can be omitted)
        vbYesNo Yes and No buttons
        vbYesNoCancel Yes, No and Cancel buttons
      • The default button (the one that is pressd when you hit the Enter key):
        vbDefaultButton1 First button is default button (default, can be omitted)
        vbDefaultButton2 Second button is default button
        vbDefaultButton3 Third button is default button

        [/list]You can add an option from each of these groups.

        The result of the MsgBox function is one of the constants vbAbort, vbCancel, vbIgnore, vbNo, vbOK, vbRetry or vbYes, corresponding to the button clicked by the user.

      • #606068

        Thanks for the handy info. I can’t believe I hadn’t stumbled across this myself in the past.

        It’s exactly what I needed and simple.

        Thanks!!
        Troy

        • #606141

          [indent]


          I can’t believe I hadn’t stumbled across this myself in the past


          [/indent]
          With Microsoft’s GREAT helpfiles, I can’t believe it either…

          (That was totally sarcastic… I am often frustrated by how bad their helpfiles are.)

        • #606294

          The most likely explanation is that instead of working your way through a boring, step-by-step tutorial in VBA, you decided to learn it by tackling an extremely difficult project. wink

    Viewing 0 reply threads
    Reply To: Is there a boolean equivalent to InputBox? (VBA Word 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: