limiting the use of macros to a specific section

B

Bob Shaw

I have a portrait orientated document that has a macro to
insert a landscape page (and adjust headers/footers) into
the body of the document.

I also have a macro to start the appendices and one that
inserts a landscape page into the appendices. Once the
appendices have been started only the appendix insert
landscape page can be used in the appendices. Similarly in
the body section only the body insert landscape page can be
used.

What is the best way of limiting the use of a macro to a
specific section?
 
J

Jay Freedman

Hi, Bob,

There is no way to prevent a macro from launching in some sections and not
others. You'll have to write logic into the macro to recognize what kind of
section contains the cursor at the time the macro starts, and immediately
exit without doing anything (other than maybe showing a message box) if it's
in the "wrong" kind of section. I don't know whether you want to base that
recognition on the section's orientation, the section's number, or some
other criterion.
 

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