View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_656_] Leith Ross[_656_] is offline
external usenet poster
 
Posts: 1
Default Run Time Error on Closing UserForm


Hello Bill,

You can determine which close button was chosen and skip UserForm.Hide
if it was the window close button (red X). This information is made
available in the UserForm_QueryClose event.

Here is an example...


Code:
--------------------

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

If CloseMode = 0 Then Exit Sub 'Red X was clicked
UserForm1.Hide

End Sub

--------------------


If the user clicks your close button, CloseMode will equal 1.

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=561736