PDA

Click to See Complete Forum and Search --> : SOLVED: (thanks) userform close-symbol


tonyelyn
Oct 4th, 2005, 03:05 AM
Hello,
is it possible to hide or to disable the close-symbol ((X) upper right) on a userform? And if so, how you do it ??
Thanks in advange

Chris67
Oct 4th, 2005, 08:54 AM
Hi
pls give some more information about the userfom!
is it in VB / Excel / Word ...... ?

Chris

tonyelyn
Oct 4th, 2005, 10:14 AM
Hi
pls give some more information about the userfom!
is it in VB / Excel / Word ...... ?

Chris

excuse me,
the form is made in EXCEL.
Commandbuttons are on the userform and are used to simplify the work of other users.

NeedSomeAnswers
Oct 4th, 2005, 11:11 AM
I dont think you can get a handle on the Excel VBA userform object the same way you can in VB Form object to disable the X button.

You can cheat though by intercepting the X QueryClose command like below

put this code in a userform, and try pressing the X button !



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

If CloseMode = vbFormControlMenu Then
Cancel = True
End If

End Sub

RobDog888
Oct 4th, 2005, 11:32 AM
I just wrote this code for you to actually Disable the 'x' close button on a VBA userform (http://www.vbforums.com/showthread.php?t=363931). :D

NeedSomeAnswers
Oct 4th, 2005, 11:47 AM
Fair play Rob Dogg,

will be nicking that bit of code myself !!!

Didn't know you could do that with VBA userforms.

RobDog888
Oct 4th, 2005, 11:50 AM
Me neither but I thought it was worth a try. Not having a controlbox or system menu I wouldnt think it would work but it did just as if it was there. The close menu item in the system menu is in the same place for all stardard windows. So I took a chance. :D