Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Can Wscript catch the MS Word Application Event "DocumentBeforePrint" ?

Reply
 
Old 06-10-2009   #1 (permalink)
Harold Little


 
 

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

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.



My System SpecsSystem Spec
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
Old 06-11-2009   #3 (permalink)
Harold Little


 
 

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

Thank you Tom Lavedas for answering my question.
Harold

"Harold Little" <harold.little@xxxxxx> wrote in message
news:OG8eh8d6JHA.1716@xxxxxx
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.
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
wscript.echo only a new line / embed a "CR" in a text string ? VB Script
microsoft.public.windowsxp.general posts reappear after "catch up" Live Mail
Files with extension ".doc" should be opened in Microsoft Word Application Vista security
Files with extension ".doc" should be opened in Microsoft Word Application Vista General
"Catch Up" vs. "Mark All Read" Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46