View Single Post
 
Old 06-15-2010, 12:31 PM
maruapo maruapo is offline Windows 7 Office 2007
Novice
 
Join Date: Jun 2010
Posts: 2
maruapo is on a distinguished road
Default DocumentBeforePrint not working

I'm trying to force a dialog box to appear when users press Print. I know all about DocumentBeforePrint, but despite scouring the Net and double-triple-quadruple checking my code, my code doesn't err out but it doesn't work either. I've created a Class Module called "EventClassModule" and referenced it in a Module. Could it be related to my being on a huge corporate network and the printers are shared? I'm out of ideas; this code should work. Why doesn't it?

Here's what's in my 'regular' module:
Sub Register_Event_Handler()
Dim x As New EventClassModule
Set x.v = Word.Application
End Sub
Here's what's in the Class Module:
Public WithEvents v As Word.Application
Private Sub v_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
Dim intResponse As Integer
intResponse = MsgBox("Have you checked the " _
& "printer for letterhead?", _
vbYesNo)
If intResponse = vbNo Then Cancel = True

End Sub
Reply With Quote