Add a field to footing programmatically

C

Craig McDonald

I would like to add a "Page of Page" field (PAGE of NUMPAGES) to the footing
of each page via a macro. How can this be done? Thanks in advance.
 
W

Word Heretic

G'day "Craig McDonald" <[email protected]>,

Document.Fields.Add

for the range use the collapsed range of the end of your footer

footers can be found in document.storyranges or
document.sections.footers



Craig McDonald said:
I would like to add a "Page of Page" field (PAGE of NUMPAGES) to the footing
of each page via a macro. How can this be done? Thanks in advance.

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 
C

Cindy Meister -WordMVP-

Hi Craig,
I would like to add a "Page of Page" field (PAGE of NUMPAGES) to the footing
of each page via a macro
by definition, a footer will appear on each page, so if you haven't
constructed a document with "different first page" or unconnected sections,
you should only need to insert the field *combination* once.

Then there is the question about where in the footer this should appear.

I suggest you record a macro, *while in the footer*, to insert everything
exactly where you want it. Copy the macro code and paste it into your next
reply. Then we'll show you how to make Word insert it correctly into the
footer, even when you're not currently in the footer.

Don't forget to tell us:
- the version of word you have
- whether your document has "different first page", "odd" or disconnected
sections

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan 24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
C

Craig McDonald

Cindy - Actually I will be updating page numbers for all pages in a document
using Word 2000, but other versions may be used. I am creating a document
with a TOC and an index, with several inserted sections, each having an
activity and task. What I am trying to do is paste the Activity and Task
into the footer of each non-TOC and non-Index page. There may be several
pages in each section having the same task and activity. The footer would
look kind of like this although the words "Activity:" and "Task:" don't need
to appear in the footer:


Activity: Check processing - Page 2 of 6 -
Task: Check printing


Note: The Activity is left justified, the pages are center-justified and the
tasks are right-justified. The activities and tasks are custom document
properties. I was pasting the actual text rather than inserting a field for
the Activities and Tasks as some versions of Word crashed with document
variables or document properties in the footer. I hope this gives you a
better understanding of what we are trying to do. Thanks again, in
advance. -Craig
 
W

Word Heretic

G'day "Craig McDonald" <[email protected]>,

Check out the StyleRef field. Essentially, style the text that is to
be copied into the header and footer with a unique style and use the
styleref field in the H&F to get at it.

It is how printed dictionaries get the last entry / first entry on
each page into their H&F.



Craig McDonald said:
Cindy - Actually I will be updating page numbers for all pages in a document
using Word 2000, but other versions may be used. I am creating a document
with a TOC and an index, with several inserted sections, each having an
activity and task. What I am trying to do is paste the Activity and Task
into the footer of each non-TOC and non-Index page. There may be several
pages in each section having the same task and activity. The footer would
look kind of like this although the words "Activity:" and "Task:" don't need
to appear in the footer:


Activity: Check processing - Page 2 of 6 -
Task: Check printing


Note: The Activity is left justified, the pages are center-justified and the
tasks are right-justified. The activities and tasks are custom document
properties. I was pasting the actual text rather than inserting a field for
the Activities and Tasks as some versions of Word crashed with document
variables or document properties in the footer. I hope this gives you a
better understanding of what we are trying to do. Thanks again, in
advance. -Craig

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 

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