+ Reply to Thread
Results 1 to 2 of 2

How to have a cancel button on this userform

  1. #1
    Forum Contributor
    Join Date
    05-19-2012
    Location
    houston
    MS-Off Ver
    excel 2013
    Posts
    103

    How to have a cancel button on this userform

    Hi,

    I have a userform (aCloseDown) on workbook_beforeclose that opens when the upper right corner X is clicked to close the workbook. When Label1 (a yes close workbook button) is clicked the userform closes and the macro in workbook_beforeclose runs and the workbook then closes. That works great. I want to make Label2 a cancel button, so if it is clicked the userform closes, the macro in workbook-beforeclose does not run, and the workbook stays open.

    Is a cancel type of button this way possible?



    Userform code...

    Please Login or Register  to view this content.


    Workbook_beforeclose code...

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    12-01-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2016
    Posts
    949

    Re: How to have a cancel button on this userform

    you want to close the userform "aCloseDown" when the label2 is clicked?

    try:

    aCloseDown.Hide

+ 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. Replies: 1
    Last Post: 01-31-2016, 05:54 AM
  2. Programming a UserForm Cancel Button
    By akaytie in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-17-2014, 10:44 PM
  3. [SOLVED] exit sub when press cancel button on userform
    By hcyeap in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-22-2014, 01:13 AM
  4. Help for Code for Cancel Button on Userform.
    By allens12 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-16-2014, 11:32 PM
  5. issues with userform cancel button
    By jw01 in forum Excel General
    Replies: 0
    Last Post: 12-29-2010, 05:28 PM
  6. How do I disable the cancel button for a userform?
    By Evalis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-14-2010, 04:14 PM
  7. [SOLVED] userform cancel button
    By davegb in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2006, 12:30 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