+ Reply to Thread
Results 1 to 4 of 4

Help Replacing a Message Box With a Command Button in a Macro

  1. #1
    Forum Contributor
    Join Date
    12-11-2014
    Location
    Missouri
    MS-Off Ver
    2016
    Posts
    153

    Help Replacing a Message Box With a Command Button in a Macro

    Hi Everyone,
    I am running a WorkbookOpen macro that pops up a Message Box and when the button is clicked proceeds through the macro.
    I would like to replace that Message Box with a CommandButton1_Click() button in UserForm1.
    I am not sure how or where to insert that in the macro.

    Any help would be appreciated!

    Thanks,
    Dean

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Help Replacing a Message Box With a Command Button in a Macro

    .
    The the body of your macro and paste it into a REGULAR MODULE :

    Please Login or Register  to view this content.

    Paste a Command Button on the Sheet of your choice and assign it to the above macro .

  3. #3
    Forum Contributor
    Join Date
    12-11-2014
    Location
    Missouri
    MS-Off Ver
    2016
    Posts
    153

    Re: Help Replacing a Message Box With a Command Button in a Macro

    Logit,
    Thanks for the reply! I probably wasn't specific but what happens is when the Workbook_Open macro runs it tests to see if macro's are enabled. If they are not the MsgBox pops up and clicking
    enter "enable macros". If I deactivate the line 'MsgBox "ENTER DSR" then the standard "enable macros" appears in the ribbon. All I want to do is replace the MsgBox popping up with my own command button in a user form.
    Thanks,
    Dean

  4. #4
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,015

    Re: Help Replacing a Message Box With a Command Button in a Macro

    .
    Kinda confusing precisely what you are seeking. Sorry.

    If you create a UserForm1 for your project. On that UserForm1 place a CommandButton. Let's say this button is the first button you have
    inserted on the UserForm so it is "CommandButton1".

    Right click the button and select VIEW CODE. Paste this in the button code :

    Please Login or Register  to view this content.
    If the above does not answer your question you'll need to provide additional information.

+ 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. Error message needed if text is red before a command button runs it's coding
    By kjb123 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-27-2017, 06:20 PM
  2. [SOLVED] Test for file open from Command Button on userform - not displaying open already message
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-02-2017, 09:45 AM
  3. Replies: 2
    Last Post: 02-02-2016, 10:27 PM
  4. Inserting Row Macro using Command Button (ActiveX) relative to Button
    By mebailey in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-12-2016, 09:17 PM
  5. VBA code to create command button. Print all sheets then delete command button.
    By Declamatory in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-15-2015, 05:18 PM
  6. Show message when hovering mouse over command button
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-10-2015, 02:26 PM
  7. Error message when clicking on a command button asigned a macro
    By steve123456 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-15-2012, 01:43 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