From: G Teachman on
Hello,

When searching for a phrase in a highlighted selection of a document; if the
phrase is not found Word responds with a Yes/No dialog box basically saying
it didn't find the phrase would I like to search the remaining part of the
document. Select 'yes' to search the rest of the document, or no don't
search the rest of the document.

When creating a macro that does the same thing, the 'did not find' dialog
box does not display. So, I can't tell it to stop searching.

When I run a macro created to do this kind of thing, the dialog box does
show up. Since I want the answer to be 'No' all the time, this is annoying.

Does anyone know how to get all dialog boxes to show up when recording a
macro?

Thanks,
--
G Teachman
Soil Scientist
From: Jay Freedman on
It's impossible to get the dialogs to show during recording; it's also
impossible to do certain other things, like editing graphics. That's just
the way the recorder is. You have to learn enough about VBA to write the
correct code without the recorder, or by modifying a recorded starting
point. See http://www.word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm
for some help with that.

In this particular case, a running macro that does a find or replace never
displays that message anyway. Instead, you put a line of code into the macro
to tell it what behavior to use. If you want the search to end when it
reaches the end of the document, then the .Wrap property of the .Find object
should be set to the value wdFindStop. The recorder always puts in the line

..Wrap = wdFindContinue

which you need to change in the macro editor.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

G Teachman wrote:
> Hello,
>
> When searching for a phrase in a highlighted selection of a document;
> if the phrase is not found Word responds with a Yes/No dialog box
> basically saying it didn't find the phrase would I like to search the
> remaining part of the document. Select 'yes' to search the rest of
> the document, or no don't search the rest of the document.
>
> When creating a macro that does the same thing, the 'did not find'
> dialog box does not display. So, I can't tell it to stop searching.
>
> When I run a macro created to do this kind of thing, the dialog box
> does show up. Since I want the answer to be 'No' all the time, this
> is annoying.
>
> Does anyone know how to get all dialog boxes to show up when
> recording a macro?
>
> Thanks,


 | 
Pages: 1
Prev: How to call Find.execut
Next: Macro renaming