Results 1 to 2 of 2
2013-08-16, 14:23 #1
- Join Date
- Nov 2002
- Thanked 0 Times in 0 Posts
Word 2010 - Print only pages with certain phrase on them
Is there anyway you run a search for a certain phrase and then print only the pages where that phrase shows up? We have a 500+ document and maybe 100+ hits for the phrase we are looking for. We would like to be able to print only those pages without printing them a page at a time. Is there any way in Word 2010 to do that?
2013-08-16, 15:35 #2
- Join Date
- Mar 2004
- Manning, South Carolina
- Thanked 1,471 Times in 1,339 Posts
Here's some VBA that will turn the trick.
Option Explicit Sub MyFindAndPrint() Dim myRange As Range Dim bResult As Boolean Selection.WholeStory 'Select entire document With Selection.Find '**** Syntax of Find Execute incase you want to use some of the '**** other parameters. ' expression .Execute(FindText, MatchCase, MatchWholeWord, _ ' MatchWildcards, MatchSoundsLike, MatchAllWordForms, _ ' Forward, Wrap, Format, ReplaceWith, Replace, MatchKashida,_ ' MatchDiacritics, MatchAlefHamza, MatchControl) .ClearFormatting .MatchWholeWord = True .MatchCase = False Do bResult = .Execute(FindText:="passwords") '<- Your phrase here! If bResult Then ' Debug.Print bResult Application.PrintOut FileName:="", Range:=wdPrintCurrentPage, Item:= _ wdPrintDocumentWithMarkup, Copies:=1, Pages:="", PageType:= _ wdPrintAllPages, Collate:=True, Background:=True, PrintToFile:=False, _ PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _ PrintZoomPaperHeight:=0 End If Loop Until Not bResult End With End Sub 'MyFindAndPrint