before print

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i am using xp and trying to have a msgbox appear before printting. i am using
the following code.
Public WithEvents App As Word.Application

Private Sub App_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 = False
End Sub


Dim X As New EventClassModule
Sub Register_Event_Handler()
Set X.App = Word.Application
End Sub

i cant seem to get it to work. any suggestions
thanks
 
Hi Don,

The name Register_Event_Handler doesn't have any significance to Word, so
that procedure isn't getting called. Either rename that procedure to
AutoExec, or explicitly call Register_Event_Handler from AutoExec (if you
already have an AutoExec that's doing other work). See
http://word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm for step-by-step
instructions.

BTW, this question really belongs in one of the microsoft.public.word.vba
newsgroups.
 
Back
Top