Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-25-2018, 02:35 AM
Peltz Peltz is offline Execute VBA before printing Windows XP Execute VBA before printing Office 2003
Novice
Execute VBA before printing
 
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Execute VBA before printing Why does this Macro take so long to execute? poetofpiano Word VBA 3 09-30-2017 11:59 PM
Execute autocorrects? KaiserD2 Word 6 04-03-2017 10:18 PM
Execute VBA before printing Execute VBA on File Import npalmer610 Word VBA 1 04-12-2016 06:01 PM
Execute VBA before printing word 2010 mail merge execute twice smaddi Mail Merge 1 02-05-2012 02:45 AM
Execute VBA before printing Find and Execute cksm4 Word VBA 1 10-22-2011 11:36 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:57 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft