Create a macro for finding a text i:e "The" and period "."

  • Thread starter Ananda Sukhramani
  • Start date
A

Ananda Sukhramani

Please let me know coding for creating a macro how to find a text ie "The and
period "." in whole word document.!!!!
 
C

Charles Kenyon

Try recording it.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide


--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
G

Greg Maxey

Ananda,

The following is a basic macro for finding "The" (with a capital "T") and a
period "." and formatting them with red font color.

What specifically are you trying to do?

Sub Sratchmacro()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Content
With oRng.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "The"
.MatchCase = True
.Replacement.Font.Color = wdColorRed
.Execute Replace:=wdReplaceAll
.Text = "."
.Execute Replace:=wdReplaceAll
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top