View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default remove close button

easier is to use the queryclose event to control the closing of the form:

Private Sub UserForm_QueryClose(cancel As Integer, closemode As Integer)

here are the possible values for the closemode argument

vbFormControlMenu
0
The user has chosen the Close command from the Control menu on the
UserForm.

vbFormCode
1
The Unload statement is invoked from code.

vbAppWindows
2
The current Windows operating environment session is ending.

vbAppTaskManager
3
The Windows Task Manager is closing the application.


From the closemode argument, you can test why the form is being closed - if
you disagree, you can set Cancel = True and display a warning message - for
example if closemode = vbFormControlMenu. If it is one of the other
options, you might perform some cleanup and then let the form close.

--
Regards,
Tom Ogilvy


"Josh Ashcraft" wrote in message
...
how do i remove the close button (X) from the top of a
userform?

Thanks,
Josh