Hello - total newbie to this, want to start doing more...

I'm trying to set up a macro attached to a document that, after using a
hotkey combination, prompts them for replacement text (for example, ABC
Company replaced with XYZ Corporation).

Basically, an automated way to engage the find/replace feature with a prompt
for replacement text.

I only understand the very basics of the code I've tried to create using the
Record feature, so I need some very basic instructions for my confused brain.

Can you tell me what I need? Many thanks!!

-Mike

Re: Need code for prompt and find/replace macro - help! by Greg

Greg
Fri Oct 12 20:06:47 PDT 2007

Do you mean the user selects some text e.g., ABC company and you want to
initiate a macro that will prompt them to enter the replacement text?

Sub Scratchmacro()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Range
With oRng.Find
.Text = Selection.Text
.Wrap = wdFindAsk
.Replacement.Text = InputBox("Type replacment text here: ", "Replacement
Text")
.Execute Replace:=wdReplaceAll
End With
End Sub


--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


MDon wrote:
> Hello - total newbie to this, want to start doing more...
>
> I'm trying to set up a macro attached to a document that, after using
> a hotkey combination, prompts them for replacement text (for example,
> ABC Company replaced with XYZ Corporation).
>
> Basically, an automated way to engage the find/replace feature with a
> prompt for replacement text.
>
> I only understand the very basics of the code I've tried to create
> using the Record feature, so I need some very basic instructions for
> my confused brain.
>
> Can you tell me what I need? Many thanks!!
>
> -Mike



Re: Need code for prompt and find/replace macro - help! by Graham

Graham
Fri Oct 12 22:38:53 PDT 2007

How does this differ from pressing CTRL+H?

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

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

MDon wrote:
> Hello - total newbie to this, want to start doing more...
>
> I'm trying to set up a macro attached to a document that, after using
> a hotkey combination, prompts them for replacement text (for example,
> ABC Company replaced with XYZ Corporation).
>
> Basically, an automated way to engage the find/replace feature with a
> prompt for replacement text.
>
> I only understand the very basics of the code I've tried to create
> using the Record feature, so I need some very basic instructions for
> my confused brain.
>
> Can you tell me what I need? Many thanks!!
>
> -Mike