Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Is there a way to disable the close button top right of a userform. I am
after the user only being able to use a commandbutton titled 'Exit' -- AOU |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
try this
Private Sub Userform_QueryClose(Cancel As Integer, closeMode As Integer) If closeMode = 0 Then Cancel = True MsgBox "Please use the button!" End If End Sub "AOU" wrote: Is there a way to disable the close button top right of a userform. I am after the user only being able to use a commandbutton titled 'Exit' -- AOU |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
try this
Private Sub Userform_QueryClose(Cancel As Integer, closeMode As Integer) If closeMode = 0 Then Cancel = True MsgBox "Please use the button!" End If End Sub |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
As a user, I'm accustomed to using that X to close the form. Why make it more
difficult for me? Your userform could call the commandbutton_click procedure associated with the Exit button. Option Explicit Private Sub CommandButton2_Click() 'clean up whatever you need to here. Unload Me End Sub Private Sub Userform_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then Call CommandButton2_Click End If End Sub AOU wrote: Is there a way to disable the close button top right of a userform. I am after the user only being able to use a commandbutton titled 'Exit' -- AOU -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thanks Dave.
But if I close the userfrom using the X it doesn`t save the data on the textboxes. So the reason to use the commandbutton is to hide the userform so that when opening it agian it has the details last entered. -- AOU "Dave Peterson" wrote: As a user, I'm accustomed to using that X to close the form. Why make it more difficult for me? Your userform could call the commandbutton_click procedure associated with the Exit button. Option Explicit Private Sub CommandButton2_Click() 'clean up whatever you need to here. Unload Me End Sub Private Sub Userform_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then Call CommandButton2_Click End If End Sub AOU wrote: Is there a way to disable the close button top right of a userform. I am after the user only being able to use a commandbutton titled 'Exit' -- AOU -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Close automatically a userform | Excel Discussion (Misc queries) | |||
auto close userform | Excel Discussion (Misc queries) | |||
Userform + close button | Excel Discussion (Misc queries) | |||
Excel shoud not close all active books when clicking close button | Excel Discussion (Misc queries) | |||
excel - Windows close button (x) should only close active workboo. | Setting up and Configuration of Excel |