+ Reply to Thread
Results 1 to 7 of 7

Creating a message box with multiple options

  1. #1
    Registered User
    Join Date
    02-24-2017
    Location
    Minnesota
    MS-Off Ver
    2016
    Posts
    17

    Creating a message box with multiple options

    Hello.

    I am wondering to how create a message box in VBA that allows the user to select one of multiple options. I have used vbYesNo before, but I am now trying to do things that go beyond just a simple yes or no and I'm not sure how to go about doing that.

    What I have done in the past is make check boxes that sit on the worksheet, but if there is a way to get rid of this and put it all in vba that would be wonderful.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Creating a message box with multiple options

    The only practical way to do this is to create a userform... The standard MsgBox is limited to the Yes/No/Cancel/Abort/Retry button captions.

  3. #3
    Forum Contributor
    Join Date
    10-13-2015
    Location
    California
    MS-Off Ver
    Office 2013
    Posts
    138

    Re: Creating a message box with multiple options

    I second the use of a userform.

    If you want help creating a userform let us know.

    Short of a userform you dont have many options.

  4. #4
    Registered User
    Join Date
    02-24-2017
    Location
    Minnesota
    MS-Off Ver
    2016
    Posts
    17

    Re: Creating a message box with multiple options

    Ah yes that makes sense. That totally slipped my mind and I've never used those within Excel. I guess my main question would just be the best way to go about doing that?

    Am I able to set it up like the Yes/No message box where I just call it within the VBA and then use if statements?

    Or would writing the code in modules and then calling the subs from the button click be the best way to go about this?

  5. #5
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Creating a message box with multiple options

    See http://gregmaxey.com/word_tip_pages/...ba_msgbox.html

    Get it working first and you can be as creative as you want.

  6. #6
    Registered User
    Join Date
    02-24-2017
    Location
    Minnesota
    MS-Off Ver
    2016
    Posts
    17

    Re: Creating a message box with multiple options

    Awesome thank you very much!

  7. #7
    Forum Contributor
    Join Date
    10-13-2015
    Location
    California
    MS-Off Ver
    Office 2013
    Posts
    138

    Re: Creating a message box with multiple options

    When you create a userform you could do it either way.

    You could set the code for each button on the form to call a sub that is written in a module or you could write in the code that you want each button to accomplish within the code for the useform button.

    The choice there is yours.

    I have done it both ways.

    It really comes down to if multiple buttons will have some of the same functions. For example i have used a userform to make user-input changes to the document and then format the document the way i want it formatted.

    Since i wanted the document formatted the same way every time I wrote my format sub in a module to call so i did not have to duplicate the code multiple times.

    If each button is going to do something totally unique then writing the code in the button on the form probably makes sense.

+ 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. Need help creating a Dropdown filter with options
    By warshad in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-28-2014, 05:05 PM
  2. Replies: 0
    Last Post: 08-26-2014, 08:44 AM
  3. Creating Quote sheet with options
    By superflyte in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-29-2013, 12:54 AM
  4. Message box with variables and options
    By UsmanBPD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2012, 07:38 AM
  5. Creating a warning if options are NOT selcted
    By Biased Historian in forum Access Programming / VBA / Macros
    Replies: 6
    Last Post: 11-23-2011, 03:20 PM
  6. Different Names For Message Box Options
    By jamer02 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2011, 04:27 AM
  7. Message box options ?
    By OptionTrader in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-29-2009, 05:34 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