View Single Post
 
Old 01-25-2018, 02:35 AM
Peltz Peltz is offline Windows XP Office 2003
Novice
 
Join Date: May 2015
Posts: 1
Peltz is on a distinguished road
Default Execute VBA before printing

Hello.

I'm trying to open a messagebox prompting a yes/no question when someone presses the print-icon in Word 2013.

This is the code I've written:

Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)Dim Result As Long
Result = MsgBox("Text", vbYesNo)
If Result = vbNo Then
Exit Sub
Else
ActiveDocument.PrintOut
End If
End Sub
Sub FilePrintDefault()
Dim Result As Long
Result = MsgBox("Text", vbYesNo)
If Result = vbNo Then
Exit Sub
Else
ActiveDocument.PrintOut
End If
End Sub

However, I can't get the code to fire. Some input on how to get the code to fire would be much appreciated.

Thanks
Reply With Quote