![]() |
#1
|
|||
|
|||
![]()
I am trying to capture Ctrl-P and the Print-button to redirect.
I have searched and found the following macro: ThisDocument section: Option Explicit Public Sub AutoExec() Register_Event_Handler End Sub Module1: Option Explicit Dim X As New EventClassModule Sub Register_Event_Handler() Set X.WordAppEvents = Word.Application End Sub EventClassModule: Option Explicit Public WithEvents WordAppEvents As Word.Application Private Sub WordAppEvents_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean) Cancel = True ' Run code directly inside this Sub OR MsgBox "Before Print" ' Call another Sub here, note, Sub and Module name can't match Cancel = False End Sub ************************************* The template, in which this macro is, is loaded automatically when starting Word. When I try to print, I would expect the messagebox, but this is not shown. ![]() When I modify the EventClassModule: Private Sub WordAppEvents_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean) to Private Sub WordAppEvents__DocumentBeforeSave(ByVal Doc As Document, SaveAsUI As Boolean, Cancel As Boolean) The popup is shown. ![]() It seems DocumentBeforePrint has a problem. I am using Word version 2101 (build 13628.20380 Click-and-Run) Anyone who can help me get this working? Thanks in advance for your response. Gerrit |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
ksigcajun | Word VBA | 6 | 04-06-2015 07:41 AM |
Powerpoint save as WMV but media doesnt work. | hooney | PowerPoint | 0 | 02-21-2013 09:45 PM |
Safe Senders Doesnt work | Anil Kaul | Outlook | 0 | 11-16-2012 01:28 PM |
![]() |
rmw85 | Word VBA | 1 | 04-25-2012 01:02 PM |
![]() |
dukquaknoobhack | Office | 1 | 01-05-2012 03:43 PM |