How to run sub if userform closes on error

dchaney

Well-known Member
Joined
Jun 4, 2008
Messages
732
Office Version
  1. 2016
Platform
  1. Windows
Hello all,

I have a userform currently that opens when the file opens, it is a "floating" form so it is always up, I hide all borders and disabled the X close button on the excel file. Everything is working great, except if for any reason there is an error that causes the userform to close there is no way (shot of right clicking and exiting program) for the user to close the file.

for instance, if I step through any portion of my code and I hit stop, the userform closes... does this close fire any additional subs?

Is there anyway at all to have a sub fire if the form closes for any reason at all? The Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) does not work, already tried that...
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Have you looked at the userform's Terminate event?
 
Upvote 0
Yes, it does not seem to run ether, I am having a difficult time to get the form to "Error" as one of my co-workers and said it did on him this morning. I have the terminate sub set up to run incase. Thanks
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,178
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top