G
golf4
Hi, everyone -
While watching one of my staff use my rent calculation tool this
morning, I noticed that when the initial splash screen appeared, she
would just close the "X" Close button in the upper right hand corner.
I want to prevent this.
I did my Search (proud of me, heh???), and found the exact code I
needed. To enforce the msg box, I also want to include a wav if the
Close button is pressed. I, kind of, messed with my code below, but it
doesn't seem to work ---looking to have the wav play at the same time
as the msg box.
Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
'Prevents use of the Close button'
Application.ScreenUpdating = True
DoEvents
ActiveSheet.Shapes("object 204.wav").Select
Selection.Verb Verb:=xlPrimary
If CloseMode = vbFormControlMenu Then
MsgBox "YOU SHOULD NOT BE CLOSING THIS FORM!!!"
Cancel = True
End If
End Sub
Any help would be fantastic.
Thanks,
Golf
While watching one of my staff use my rent calculation tool this
morning, I noticed that when the initial splash screen appeared, she
would just close the "X" Close button in the upper right hand corner.
I want to prevent this.
I did my Search (proud of me, heh???), and found the exact code I
needed. To enforce the msg box, I also want to include a wav if the
Close button is pressed. I, kind of, messed with my code below, but it
doesn't seem to work ---looking to have the wav play at the same time
as the msg box.
Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
'Prevents use of the Close button'
Application.ScreenUpdating = True
DoEvents
ActiveSheet.Shapes("object 204.wav").Select
Selection.Verb Verb:=xlPrimary
If CloseMode = vbFormControlMenu Then
MsgBox "YOU SHOULD NOT BE CLOSING THIS FORM!!!"
Cancel = True
End If
End Sub
Any help would be fantastic.
Thanks,
Golf