ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Form Close Button (https://www.excelbanter.com/excel-programming/342614-form-close-button.html)

ceemo[_37_]

Form Close Button
 

Hi,

Ive created a password form that activates on workbook open and i wan
to disble the red cross in the top right corner of the form or chang
the code to disble the form.

can this be done, please help


thank you all as always for your hel

--
ceem
-----------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...fo&userid=1065
View this thread: http://www.excelforum.com/showthread.php?threadid=47559


Jim Rech

Form Close Button
 
Just add this to your userform's code module:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then Cancel = 1
End Sub

When the X is clicked CloseMode is 0. But when you do an UnLoad Me
CloseMode will be 1 so the form will close.

--
Jim
"ceemo" wrote in
message ...
|
| Hi,
|
| Ive created a password form that activates on workbook open and i want
| to disble the red cross in the top right corner of the form or change
| the code to disble the form.
|
| can this be done, please help
|
|
| thank you all as always for your help
|
|
| --
| ceemo
| ------------------------------------------------------------------------
| ceemo's Profile:
http://www.excelforum.com/member.php...o&userid=10650
| View this thread: http://www.excelforum.com/showthread...hreadid=475594
|



bigwheel

Form Close Button
 
Hi, take a look he- http://www.oaltd.co.uk/Excel/

"ceemo" wrote:


Hi,

Ive created a password form that activates on workbook open and i want
to disble the red cross in the top right corner of the form or change
the code to disble the form.

can this be done, please help


thank you all as always for your help


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=475594



bigwheel

Form Close Button
 
NoCloseButton.zip about 2/3rds down the page or perhape this code would help
(placed on your userform -

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

' Prevents use of a Close/Cancel button
If CloseMode = vbFormControlMenu Then
MsgBox "Please select the CANCEL button.", , ""
Cancel = True
End If

End Sub


"bigwheel" wrote:

Hi, take a look he- http://www.oaltd.co.uk/Excel/

"ceemo" wrote:


Hi,

Ive created a password form that activates on workbook open and i want
to disble the red cross in the top right corner of the form or change
the code to disble the form.

can this be done, please help


thank you all as always for your help


--
ceemo
------------------------------------------------------------------------
ceemo's Profile: http://www.excelforum.com/member.php...o&userid=10650
View this thread: http://www.excelforum.com/showthread...hreadid=475594




All times are GMT +1. The time now is 10:19 AM.

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