Code execution on footer change

M

Matt

I am trying to get some code to run when a changes is made to the footer in a
word document any ideas on how to do this.
 
M

Matt

It is to make a sort of treasure hunt for student learning how to use word so
when the have but their name in the footer it will then give them to more
pages in the document and add some text to the document
 
J

Jonathan West

Matt said:
It is to make a sort of treasure hunt for student learning how to use word
so
when the have but their name in the footer it will then give them to more
pages in the document and add some text to the document

The WindowSelectionChange event fires whenever you change the position of
the selection using the mouse or the arrow keys you could have this event
test for the presence of the user's name in the footer, and add the pages if
it is present. (You would need to set a flag so that you only add the extra
pages once)

This would cause the pages to be added when the use comes out of the
header/footer view.

For how to use application event procedures such as WindowSelectionChange,
take a look at this article

Writing application event procedures
http://www.word.mvps.org/FAQs/MacrosVBA/AppClassEvents.htm


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.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