Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-27-2022, 11:19 AM
NLDLC NLDLC is offline highlight text in array Windows 10 highlight text in array Office 2021
Novice
highlight text in array
 
Join Date: Jan 2022
Posts: 5
NLDLC is on a distinguished road
Default highlight text in array


Hi. I'm currently using the below VBA to find specific words (the myWords array) and then print those pages.

Code:
Sub PrintSpecificWords()
Dim myWords()
Dim j As Long
myWords = Array("Word1", "Word2", "Word3", "Word4", "Word5")

For j = 0 To UBound(myWords())
With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
Do While .Execute(FindText:=myWords(j), _
Forward:=True) = True
Application.PrintOut _
Range:=wdPrintCurrentPage
Loop
End With
End With
Next j
End Sub
I have attempted unsuccessfully to modify this to include additional code which would highlight the text found within the array after printing it (I plan to use this as to reconcile which pages have been printed).

Is there a way to do this using my existing "myWords" array?
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
like to highlight web text, enter cntl key, have text appended to same onenote pate bobk544 OneNote 0 12-10-2017 11:49 AM
highlight text in array Create an array or list of highlighted text in selection rjrichar40 Word VBA 1 09-03-2014 01:02 PM
highlight text in array Convert String Array to Integer Array from a User Input? tinfanide Excel Programming 4 12-26-2012 08:56 PM
highlight text in array Array into ComboBox + Macro-Text into ActiveDocument Vivi Word VBA 1 01-27-2010 07:03 AM
find - reading highlight - highlight all / highlight doesn't stick when saved bobk544 Word 3 04-15-2009 03:31 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:02 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