View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
peter.thompson[_14_] peter.thompson[_14_] is offline
external usenet poster
 
Posts: 1
Default Preventing user from closing form with "X"


Am using the following code to make sure user closes a form correctly

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode A
Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "You must use the form 'close' button", 64, "Erro
Message"
End If
End Sub

I have 60 userforms. Rather than apply code in each form, is there
way to universally apply this to all forms in the workbook??

Follow up question, is it possible to remove the Microsoft "X" at th
top right hand side of the UserForm??

Any help much appreciated


Peter (new to VBA...slowly getting there, thanks to all the good advic
from this forum!

--
peter.thompso
-----------------------------------------------------------------------
peter.thompson's Profile: http://www.excelforum.com/member.php...fo&userid=2968
View this thread: http://www.excelforum.com/showthread.php?threadid=49610