Help Replace Headers Footers w/ Autotext? 
Author Message
 Help Replace Headers Footers w/ Autotext?

I need a macro that will run through all the headers and footers in a
document and replace the totality of whatever is there with named
AutoText entries. The AutoText entries contain a mixture of graphics,
text and dynamic fields (page numbers, StyleRefs, etc.). The first page
header is different from the others and the odd and even headers and
footers are also different. I've been playing around with various
functions of this type but I can't get the syntax quite right. Any help
would be appreciated.

1st attempt : replaces a specific entry on the page where the cursor is
found.
****
Sub ChangeID0()
    If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
        ActiveWindow.Panes(2).Close
    End If
    If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow.
_
        ActivePane.View.Type = wdOutlineView Then
        ActiveWindow.ActivePane.View.Type = wdPrintView
    End If

    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    Selection.WholeStory
    ActiveDocument.AttachedTemplate.AutoTextEntries("WorldImage").Insert
Where _
        :=Selection.Range
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
****

This resulted from just recording the actions of opening the
Headers-Footers window, doing a CTRL+A to select the whole of the
current section, and inserting the AutoText.

Now what I would like is to be able to get this to loop through the
whole document, and to be able to distinguish without panic or crashing
whether the element to replace is a First , Primary or Even Page. My
first problem is thus to find the object to loop on (Neither
HeadersFooters nor Pages is a child of the Document object), then
getting the program to distinguish the type of the HeaderFooter object.

Many thanks to anyone who can help me with the syntax for this, or offer
a better suggestion.
--
Elisa Francesca Roselli
Technical Writer
Quadratec Software - France



Tue, 23 Dec 2003 21:42:49 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. How To Find/Replace in Headers and Footers?

2. Find/Replace in Header/Footer

3. find/replace on headers&footers

4. Find and Replace fails to replace all sections of footer

5. Automatic TOC with Section Headers in Header/Footer

6. Updating AutoText in template footer

7. Insert AutoText in Footer via Macro

8. Need Help on header and Footer

9. help needed: Printing with Headers, footers and rtf boxes

10. Header and Footer help required

11. Help Replacing Header Text in Word

12. Inserting AutoText in Header and retaining formatting

 

 
Powered by phpBB® Forum Software