Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

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

    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:
    <UL><LI>The icon to display:
    <table border=1><td valign=top>vbCritical</td><td valign=top>Stop sign</td><td valign=top>vbExclamation</td><td valign=top>Exclamation mark</td><td valign=top>vbInformation</td><td valign=top>Information sign</td><td valign=top>vbQuestion</td><td valign=top>Question mark</td></table>
    <LI>The buttons to display:
    <table border=1><td valign=top>vbAbortRetryIgnore</td><td valign=top>Abort, Retry and Ignore buttons</td><td valign=top>vbOKCancel</td><td valign=top>OK and Cancel buttons</td><td valign=top>vbOKOnly</td><td valign=top>OK button (default, can be omitted)</td><td valign=top>vbYesNo</td><td valign=top>Yes and No buttons</td><td valign=top>vbYesNoCancel</td><td valign=top>Yes, No and Cancel buttons</td></table>
    <LI>The default button (the one that is pressd when you hit the Enter key):
    <table border=1><td valign=top>vbDefaultButton1</td><td valign=top>First button is default button (default, can be omitted)</td><td valign=top>vbDefaultButton2</td><td valign=top>Second button is default button</td><td valign=top>vbDefaultButton3</td><td valign=top>Third button is default button</td></table>[/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.

  3. #3
    4 Star Lounger
    Join Date
    Apr 2001
    Posts
    482
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    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

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    <hr>I can't believe I hadn't stumbled across this myself in the past<hr>
    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.)

  5. #5
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

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

    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. <img src=/S/wink.gif border=0 alt=wink width=15 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •