Reply
 
Thread Tools Display Modes
  #1   Report Post  
leaftye
 
Posts: n/a
Default [vba] search and format finds


I figured it out. Here's what my final code looks like:

Code:
--------------------

Sub UnderlineWords()
' Underline all the words in this array

Dim WordsToUnderline(10) As String
WordsToUnderline(0) = "access"
WordsToUnderline(1) = "assignment"

For i = 0 To UBound(WordsToUnderline)
With Selection.Find
.ClearFormatting
With .Replacement
.ClearFormatting
.Font.Underline = wdUnderlineSingle
.Text = WordsToUnderline(i)
End With
.Text = WordsToUnderline(i)
.Forward = True
.Wrap = wdFindContinue
.Format = True
.Execute Replace:=wdReplaceAll
End With
Next


End Sub
--------------------


--
leaftye
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
different "number format" for the same "level heading" Waleed Microsoft Word Help 3 June 26th 05 05:15 AM
Search and Replace not working if I select a Format for Heading St Sherrie Deen Microsoft Word Help 0 April 27th 05 08:53 PM


All times are GMT +1. The time now is 01:36 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"