Group:  Microsoft Word ยป microsoft.public.word.vba.general
Thread: Macro for Finding Highlighted Text

Geek News

Macro for Finding Highlighted Text
e125 12/30/2008 4:24:17 PM
Version of Word 2003: I would like to record a macro for my finding
highlighted text in my documents. However, when I record the macros using the
"record a New Macro" feature in Tools, the recording button goes blank
indicating that the macro is no longer recording. Is there a way to work
around this glitch? Also, what is the VBA code for calling up the find and
replace dialog box?

Thanks in advance.
Re: Macro for Finding Highlighted Text
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 12/31/2008 8:49:35 AM
The macro recorder does not always work as you might hope. Some things you
have to code manually.
It is simple enough to find text that is highlighted - what do you want to
do with the highlighted text once you have found it?
The code to call the replace dialog is

Dialogs(wdDialogEditReplace).Show


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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


e125 wrote:
[Quoted Text]
> Version of Word 2003: I would like to record a macro for my finding
> highlighted text in my documents. However, when I record the macros
> using the "record a New Macro" feature in Tools, the recording button
> goes blank indicating that the macro is no longer recording. Is there
> a way to work around this glitch? Also, what is the VBA code for
> calling up the find and replace dialog box?
>
> Thanks in advance.


Re: Macro for Finding Highlighted Text
e125 12/31/2008 2:05:01 PM
Thank you for the response. Upon finding the text, I need to 1) leave the
word / symbol selected; 2) close the dialog box; 3) analyze the highlighted
word or symbol it has found, then manually remove the highlighted word or
symbol. Steps 1 & 2 can be placed in a macro.

Thank you for your help.


"Graham Mayor" wrote:

[Quoted Text]
> The macro recorder does not always work as you might hope. Some things you
> have to code manually.
> It is simple enough to find text that is highlighted - what do you want to
> do with the highlighted text once you have found it?
> The code to call the replace dialog is
>
> Dialogs(wdDialogEditReplace).Show
>
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> e125 wrote:
> > Version of Word 2003: I would like to record a macro for my finding
> > highlighted text in my documents. However, when I record the macros
> > using the "record a New Macro" feature in Tools, the recording button
> > goes blank indicating that the macro is no longer recording. Is there
> > a way to work around this glitch? Also, what is the VBA code for
> > calling up the find and replace dialog box?
> >
> > Thanks in advance.
>
>
>
Re: Macro for Finding Highlighted Text
"Graham Mayor" <gmayor[ at ]REMOVETHISmvps.org> 12/31/2008 2:33:37 PM
The following macro will find the next highlighted item from the cursor
position

With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = ""
.Replacement.Text = ""
.Highlight = True
.Wrap = wdFindContinue
.Execute
End With

Attach to a toolbar button or keyboard shortcut
http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>


e125 wrote:
[Quoted Text]
> Thank you for the response. Upon finding the text, I need to 1) leave
> the word / symbol selected; 2) close the dialog box; 3) analyze the
> highlighted word or symbol it has found, then manually remove the
> highlighted word or symbol. Steps 1 & 2 can be placed in a macro.
>
> Thank you for your help.
>
>
> "Graham Mayor" wrote:
>
>> The macro recorder does not always work as you might hope. Some
>> things you have to code manually.
>> It is simple enough to find text that is highlighted - what do you
>> want to do with the highlighted text once you have found it?
>> The code to call the replace dialog is
>>
>> Dialogs(wdDialogEditReplace).Show
>>
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> e125 wrote:
>>> Version of Word 2003: I would like to record a macro for my finding
>>> highlighted text in my documents. However, when I record the macros
>>> using the "record a New Macro" feature in Tools, the recording
>>> button goes blank indicating that the macro is no longer recording.
>>> Is there a way to work around this glitch? Also, what is the VBA
>>> code for calling up the find and replace dialog box?
>>>
>>> Thanks in advance.


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net