QueryClose Question

M

Mathew

Good Evening All,

Cheers to Bob for helping me out last noght.

I have managed to disable the UserForm Close (X),to force exit by command button (code below) (cr JW),
and would like to know if this is available to use on the Worksheet, and the Workbook?

Private Sub UserForm_QueryClose _
(Cancel As Integer, Closemode As Integer)
If Closemode = vbFormControlMenu Then
MsgBox "Please Click The Exit Button To Close The File."
Cancel = True
End If
End Sub

Cheers
Mathew
 
B

Bob Phillips

Hi Mathew,

In a workbook, there is the BeforeClose event, which has a Cancel argument,
which if you set to True will stop the workbook from being closed. Not sure
what you mean by worksheet, as you don't close a worksheet, just activate or
deactivate.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
M

Mathew

Hi Bob,
Cheers for this,
(I am still learning the differences between close/dectivate etc)
Mathew


Hi Mathew,

In a workbook, there is the BeforeClose event, which has a Cancel argument,
which if you set to True will stop the workbook from being closed. Not sure
what you mean by worksheet, as you don't close a worksheet, just activate or
deactivate.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top