Hi Thomas - here is how to write the macro and add it to your toolbar
as an icon so you can just click it whenever you want. In Word, either
press ALT F11 to open Visual Basic Editor or click on Tools, Macros,
Visual Basic Editor. Once in VB Editor, you should be able to see on
the left a list a bit like an explorer list with the File, Normal at
the top with a plus sign beside it. if you cannot see the Project list
on the left click on View, and choose Project Explorer. Click the Plus
Sign beside normal. If you have never recorded a macro before then
your Normal will not have any modules. Right click Normal and click on
Insert, Module. Double click the module so it opens and on the right
hand side a blank white area will appear. Copy and paste the following
code into the white area
Sub FindSentence()
If documents.count > 0 then
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "FILE"
.Forward = True
.Format = False
.MatchCase = True
End With
Selection.Find.Execute
Selection.MoveRight Unit:=wdSentence, Count:=1, Extend:=wdExtend
Selection.Delete
End If
What the code above is doing, is, first it checks to see if a document
is open before it runs the code. If no document is open the code will
not run. If there is a document open, it finds the word FILE and
selects it, then extends the selection so the whole sentence is
selected then it deletes it. If you want to replace the sentence with
something else instead of deleting it, you can change the last line of
the code by deleting Selection.Delete and adding this line instead
Selection.TypeText "This is my new text. "
Of course the text inside the quotes you would need to change to
whatever you wanted the text to be.
Now you need to add this macro to your toolbar in word. Close the
Visual Basic Editor. In Word, right click on the toolbar area and
choose Customize. In the Dialog Box which appears, click on the
Commands Tab. From the list on the left, scroll down and choose
Macros. All your macros should display in the list on the right. You
should see Norma.Module1.FindSentence in the list. Click on it and
drag it up onto your toolbar. Now right click the entry on the toolbar
and choose Change Button Iamge, choose a picture for your button. Then
right click again and choose Text Only in Menus. Close the Customize
dialog box. Now you are ready to go.
Hope this is useful. - Lynn