ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   HOW to close a userform using a button (https://www.excelbanter.com/excel-discussion-misc-queries/205805-how-close-userform-using-button.html)

CC

HOW to close a userform using a button
 
To close a userform I wrote

Private Sub XX_Click()
UserForm.Close
End Sub

but don't Close the form I get the a error message " invallide qualifier "

HOW to close a userform using a button ?

joel

HOW to close a userform using a button
 
You need to use the name of the userform like

UserForm1.Close


"CC" wrote:

To close a userform I wrote

Private Sub XX_Click()
UserForm.Close
End Sub

but don't Close the form I get the a error message " invallide qualifier "

HOW to close a userform using a button ?


Dave Peterson

HOW to close a userform using a button
 
This is a control (like a button) on that userform that you want to close:

Private Sub XX_Click()
unload me
End Sub

Me is the userform that owns the code.



CC wrote:

To close a userform I wrote

Private Sub XX_Click()
UserForm.Close
End Sub

but don't Close the form I get the a error message " invallide qualifier "

HOW to close a userform using a button ?


--

Dave Peterson


All times are GMT +1. The time now is 11:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com