applying macro to a selected text only

J

James

Hi

Is there a way to apply a macro to a selected text only, whether the text is
a word, phrase, sentence, or paragraph? The macro is rather simple, a
recorded macro that removes vowels:

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[aeiouAEIOU]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
 
G

Graham Mayor

Change
.Wrap = wdFindContinue
to
.Wrap = wdFindStop


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


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

James

Great! Thanks a lot.

Graham Mayor said:
Change
.Wrap = wdFindContinue
to
.Wrap = wdFindStop


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


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

Hi

Is there a way to apply a macro to a selected text only, whether the
text is a word, phrase, sentence, or paragraph? The macro is rather
simple, a recorded macro that removes vowels:

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[aeiouAEIOU]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
 
A

adre77

Do you know how can I do this in Excel?
I am trying to create a macro to apply the same border format to a selected
range of cells. No luck so far... Any ideas?

Graham Mayor said:
Change
.Wrap = wdFindContinue
to
.Wrap = wdFindStop


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


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

Hi

Is there a way to apply a macro to a selected text only, whether the
text is a word, phrase, sentence, or paragraph? The macro is rather
simple, a recorded macro that removes vowels:

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[aeiouAEIOU]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
 
G

Graham Mayor

Ask Excel questions in an Excel forum. This one is for Word.

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


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

Do you know how can I do this in Excel?
I am trying to create a macro to apply the same border format to a
selected range of cells. No luck so far... Any ideas?

Graham Mayor said:
Change
.Wrap = wdFindContinue
to
.Wrap = wdFindStop


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


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

Hi

Is there a way to apply a macro to a selected text only, whether the
text is a word, phrase, sentence, or paragraph? The macro is rather
simple, a recorded macro that removes vowels:

Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[aeiouAEIOU]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
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