View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vergel Adriano Vergel Adriano is offline
external usenet poster
 
Posts: 857
Default Form with no Cancel option

Anne,

One way is to intercept the X-button in the QueryClose event of the
userform. Try something like this in the QueryClose event to cancel the
event if the user attempts to close it with the X-button:

'Check if the user is trying to close the form with the X-button
If CloseMode = vbFormControlMenu Then
Cancel = True
Exit Sub
End If



--
Hope that helps.

Vergel Adriano


"Anne Schouten" wrote:

I made an Excelform.
If a user closes the form with the X-button (Cancel) at the top righthand
corner, other macro's will give problems, so I dont want the form to be
closed with this button.

In Access you can hide this button, but so far I can see that is not
possible in Excel. How can I prevent that the user uses this Cancelbutton?

Anne