View Single Post
Old 06-10-2009   #2 (permalink)
Auric__


 
 

Re: Can Wscript catch the MS Word Application Event "DocumentBeforePrint" ?

On Wed, 10 Jun 2009 15:21:27 GMT, Harold Little wrote:
Quote:

> My example below is unable to catch WordApplication event -
> DocumentBeforePrint.
> When the Print method is clicked or selected in MS Word,
> I want to trap and cancel the print action.
>
> I am trying with XP and Word 2003, however
> My Question is has any ever trapped this event using Wscript or Wscript
> ver 5.7 ?
>
> Thank you for any help.
Wouldn't it make better sense to just do it in Word? Open the VBA editor, add
a new class module to Normal.dot, and put this in the class module:

Public WithEvents App As Word.Application
Sub App_DocumentBeforePrint(ByVal Doc As Document, ByVal Cancel As Boolean)
Cancel = True
End Sub

Now nothing should print (but it's untested).

--
A squirrel is just a rat with good PR.
My System SpecsSystem Spec