ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform (https://www.excelbanter.com/excel-programming/273114-re-userform.html)

John Wilson

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



John Wilson

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


.



Ligaya[_3_]

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

.


.



All times are GMT +1. The time now is 12:29 AM.

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