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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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