recording keystrokes

G

Greek Dunigan

How do I record keystrokes and then evoke a command to repeat those
keystrokes? For instances; I want to change the first word in a numbered
list in the document all the way through the document.
 
G

Graham Mayor

You cannot record loops with the macro recorder.
The following will replace the first word in each paragraph in the selected
text with the word(s) defines in sText

Sub ReplaceFirstWord()
Dim oPara As Paragraph
Dim sText As String
sText = "Replacement Text"
For Each oPara In Selection.Range.Paragraphs
oPara.Range.Words(1).Text = sText & Chr(32)
Next oPara
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Top