Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-28-2011, 01:10 PM
webharvest webharvest is offline Launch macro sub after hitting "create pdf" button in word Windows Vista Launch macro sub after hitting "create pdf" button in word Office 2007
Novice
Launch macro sub after hitting "create pdf" button in word
 
Join Date: Jun 2011
Posts: 6
webharvest is on a distinguished road
Question Launch macro sub after hitting "create pdf" button in word

I have three macro subs
Public Sub FilePrint()
Public Sub FilePrintDefault()
Public Sub FilePrintPreview()

That have code in them to Hide some text that I don't want to show up in the final print.



Something I forgot about is what if someone has Acrobat Writer installed so they have the "Create Pdf" button in the Acrobat Ribbon. Is there a public sub that will run if the "Create Pdf" button is hit? This way I can run the same code to hid the unwanted text prior to them creating a pdf.
Reply With Quote
  #2  
Old 06-29-2011, 04:56 PM
macropod's Avatar
macropod macropod is offline Launch macro sub after hitting "create pdf" button in word Windows 7 64bit Launch macro sub after hitting "create pdf" button in word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi webharvest,

I'm not sure you can intercept the pdf Addin's code. However, you may be able to achieve what you're after in all cases via the 'BeforePrint' event.

Using Events requires that you instantiate the app object class. To do this, create a new class module to register your events. At the top of the module put:
Code:
Public WithEvents wdApp As Word.Application
Public WithEvents wdDoc As Word.Document
Then, in a normal code module, put:
Code:
Dim wdAppClass As New ThisApplication
Public Sub AutoExec()
Set wdAppClass.wdApp = Word.Application
End Sub
This will allow you to get events from your Word document. Finally, in the 'ThisDocument' module, insert:
Code:
Private Sub wdApp_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
Application.Options.PrintHiddenText = False
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
create pdf

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Launch macro sub after hitting "create pdf" button in word Macro to print "Current Page" in Word 2010 Jshopping Word VBA 10 06-08-2012 01:15 AM
How to fix "create bookmarks using headings" as default when saving to PDF using Word ghumdinger Word 0 05-05-2011 02:11 AM
"Send and Receive all Folders" button missing (but only with one account) incognitus Outlook 0 10-12-2010 10:42 PM
How do I create an "Insert image button" oakstream Word 2 07-07-2009 03:46 AM
Launch macro sub after hitting "create pdf" button in word Create a "report" in MS Word from an Excel file KC3K7 Excel 1 06-04-2009 07:13 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:11 AM.


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