Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform
Ligaya,
Place this code in the UserForm: Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) ' Disable the "X" on the userform so that the user can't ' dismiss the userform by clicking on the "X" in the upper ' right hand corner of the userform If CloseMode = vbFormControlMenu Then Cancel = True MsgBox Prompt:="Please use the buttons on the" & vbCrLf & _ " Form to Close it" End If End Sub Note that the user could still use Ctrl + Break to get rid of the form (and stop your macros) John Ligaya wrote: I am developing a user form in which I do not want the close (x) button. When I insert a new userform, this x button is already there. Is there a way I could disable this close button? Really appreciate if any one there could help me. Thanks. Ligaya |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform
Ligaya,
disable the close button "x". i.e. makes it invisible. Can't be done without an API call. Best bet would be to look here http://www.bmsltd.co.uk/Excel/Default.htm for "FormFun.zip" and you should be able to find the piece of code necessary to do what you want. John Ligaya wrote: John, Thanks. Your VB works. However, what I really want to do is disable the close button "x". i.e. makes it invisible. Any ideas? Ligaya -----Original Message----- Ligaya, Place this code in the UserForm: Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) ' Disable the "X" on the userform so that the user can't ' dismiss the userform by clicking on the "X" in the upper ' right hand corner of the userform If CloseMode = vbFormControlMenu Then Cancel = True MsgBox Prompt:="Please use the buttons on the" & vbCrLf & _ " Form to Close it" End If End Sub Note that the user could still use Ctrl + Break to get rid of the form (and stop your macros) John Ligaya wrote: I am developing a user form in which I do not want the close (x) button. When I insert a new userform, this x button is already there. Is there a way I could disable this close button? Really appreciate if any one there could help me. Thanks. Ligaya . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Userform
John,
Thanks. I'll try that. Ligaya -----Original Message----- Ligaya, disable the close button "x". i.e. makes it invisible. Can't be done without an API call. Best bet would be to look here http://www.bmsltd.co.uk/Excel/Default.htm for "FormFun.zip" and you should be able to find the piece of code necessary to do what you want. John Ligaya wrote: John, Thanks. Your VB works. However, what I really want to do is disable the close button "x". i.e. makes it invisible. Any ideas? Ligaya -----Original Message----- Ligaya, Place this code in the UserForm: Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) ' Disable the "X" on the userform so that the user can't ' dismiss the userform by clicking on the "X" in the upper ' right hand corner of the userform If CloseMode = vbFormControlMenu Then Cancel = True MsgBox Prompt:="Please use the buttons on the" & vbCrLf & _ " Form to Close it" End If End Sub Note that the user could still use Ctrl + Break to get rid of the form (and stop your macros) John Ligaya wrote: I am developing a user form in which I do not want the close (x) button. When I insert a new userform, this x button is already there. Is there a way I could disable this close button? Really appreciate if any one there could help me. Thanks. Ligaya . . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA userform | Excel Worksheet Functions | |||
userform | New Users to Excel | |||
Userform Help in VBC | Excel Discussion (Misc queries) | |||
UserForm Help | Excel Discussion (Misc queries) | |||
UserForm | Excel Programming |