Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
applying macro to a selected text only
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 |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
applying macro to a selected text only
Change
.Wrap = wdFindContinue to .Wrap = wdFindStop -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org James wrote: 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 |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
applying macro to a selected text only
Great! Thanks a lot.
"Graham Mayor" wrote: Change .Wrap = wdFindContinue to .Wrap = wdFindStop -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org James wrote: 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 |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
applying macro to a selected text only
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" wrote: Change .Wrap = wdFindContinue to .Wrap = wdFindStop -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org James wrote: 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 |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
applying macro to a selected text only
Ask Excel questions in an Excel forum. This one is for Word.
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org adre77 wrote: 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" wrote: Change .Wrap = wdFindContinue to .Wrap = wdFindStop -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org James wrote: 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 |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Applying hidden text when recording a macro | Microsoft Word Help | |||
keyboard shortcuts applying to whole doc, not selected text | Microsoft Word Help | |||
Macro only selected text | Microsoft Word Help | |||
Applying a background colour to styles for selected text only | Microsoft Word Help | |||
Macro: Execute for Selected Text Only | Microsoft Word Help |