Error message

T

Tempy

Good day, i have a form and have disabled the "X" close button with the
code below. Since i have done that, my cancel button does not work ?
When i click on it i get the following error message " Run time error
'91'" "Object variable or with block variable not set". Could somebody
please help, i am not sure what i have done wrong.

'--------------- Close Button ----------------------------
Private Sub userform_QueryClose(Cancel As Integer, closeMode As Integer)
If closeMode = vbFormControlMenu Then
MsgBox "Please click on the cancel button to close the
document", 0, "ZA-T-M-22"
Cancel = True
End If
End Sub
'--------------- Cancel Button
------------------------------------------------
Private Sub CmdCancel_Click()
Application.DisplayAlerts = False
Unload Me
Application.Quit
End Sub

Tempy
 
T

Tempy

Hi Bob,

I got the error message to go away when pressing cancel by just having
Application.Quit, but now it appears after my code has run, when i click
on debug it then goes half into debug but then the application closes,
as i am not a taught programmer i am totally bamboozled ?

Tempy
 

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