Macros in a hurry

D

DR

I have several macros (Word 2000) intended to be navigational tools, and are
run from a toolbar, that do very little else than a search. They tend to
find any character, or the first blank space character, within a style --
which gets me to the next major level in the document. I am really just
looking for the next instance of a paragraph using the style. The macros
have a very bad tendency to skip to the second or third instance of what
they are supposed to find. A corresponding macro that searches backward
will typically find the skipped instance, so it's not a matter of not
satisfying the search condition. Does anyone know a trick to make the macro
a little more careful and dependable? They almost seem to be in too big a
hurry. Thanks.
 
J

Jean-Guy Marcil

Bonjour,

Dans son message, < DR > écrivait :
In this message, < DR > wrote:

|| I have several macros (Word 2000) intended to be navigational tools, and
are
|| run from a toolbar, that do very little else than a search. They tend to
|| find any character, or the first blank space character, within a style --
|| which gets me to the next major level in the document. I am really just
|| looking for the next instance of a paragraph using the style. The macros
|| have a very bad tendency to skip to the second or third instance of what
|| they are supposed to find. A corresponding macro that searches backward
|| will typically find the skipped instance, so it's not a matter of not
|| satisfying the search condition. Does anyone know a trick to make the
macro
|| a little more careful and dependable? They almost seem to be in too big
a
|| hurry. Thanks.

Posting your code would leave us less in the dark...

Macros do what the code dictates. If they are not dependable, it means there
is something "wrong" in the code that needs to be fixed. It is not a general
thing like:
"By doing such and such, your macros will be more dependable".

Ooops, wrote too fast! One big exception: Use Range objects instead of
Selection objects. The Selection object is notoriously wacky and
untrustworthy. Unfortunately, if you use the macro recorder, it always uses
the Selection object because, amongst other things, it cannot name ranges
or create variables on the fly, which it would need to be able to do to
record a macro with a range object.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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