+ Reply to Thread
Results 1 to 5 of 5

Change MessageBox to userform message

  1. #1
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Change MessageBox to userform message

    Instead of a messagebox use a custom userform to show message. Not sure how to get the yes or no buttons right?
    Attached Files Attached Files
    Last edited by zplugger; 01-21-2017 at 01:30 PM.

  2. #2
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Change MessageBox to userform message

    In your attachment, the BeforeClose event interfered when I went to exit your workbook, so I deleted the BeforeClose event from my download of your file.
    When posting attachments, it is customary to warn people if your file requires special handling for normal excel functionality. (Like opening and closing.)


    I'm not sure why you need both Yes and No buttons for this. But if you put code like this in the user form's code module

    Please Login or Register  to view this content.

    you can use the user form with code like this. Note that the syntax is similar to that for a MsgBox.

    Please Login or Register  to view this content.
    Last edited by mikerickson; 01-21-2017 at 12:45 PM.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  3. #3
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Change MessageBox to userform message

    Thanks mikerickson
    Guess I could just use OK to close the workbook. Not sure why I was thinking yes or no. Here is my code now,just want to call the userform instead of the messagebox. So OK would just save the workbook and exit. So what cose do I put on userform ok button and delete the workbook close event code for messagebox?


    Please Login or Register  to view this content.

  4. #4
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Change MessageBox to userform message

    I would use the built in MsgBox rather than a custom user form, unless there is a good reason for it.

    They syntax for calling the user form and reading the user's response would be like in the second code that I posted above.

  5. #5
    Forum Contributor
    Join Date
    03-05-2009
    Location
    usa
    MS-Off Ver
    Excel 2016 32Bit
    Posts
    1,173

    Re: Change MessageBox to userform message

    Thank You mikerickson for the help, got it working.

+ 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. [SOLVED] Userform problems - message box + hide/close userform
    By mariec_06 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2016, 08:37 AM
  2. Replies: 2
    Last Post: 05-24-2016, 05:27 AM
  3. [SOLVED] MessageBox & Userform
    By zplugger in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-03-2015, 04:44 PM
  4. [SOLVED] MessageBox with heading as application name and message as welcome when file is opened vba
    By KK1234 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2013, 11:37 AM
  5. [SOLVED] message box pop up within userform, clicking ok closes userform
    By teacher_rob in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-22-2012, 12:10 PM
  6. Change Text message within UserForm
    By USAMax in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-06-2007, 12:20 AM
  7. [SOLVED] Change row in a Visual Basic messagebox
    By svai in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-11-2006, 01:35 PM

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