From: Ian B on
Thanks Graham
Ranges are one of my weak points, but I have it working now.
Again, thanks!

Ian B

"Graham Mayor" <gmayor(a)REMOVETHISmvps.org> wrote in message
news:egzphzn6KHA.1888(a)TK2MSFTNGP05.phx.gbl...
> It is simply a matter of setting the ranges accurately to reflect what you
> want to do e.g. to add some 16 point text to an existing First Page header
> in Section 1 without changing the content of the header
>
> Dim oHeader As HeaderFooter
> Dim oRng As Range
> Set oHeader = ActiveDocument.Sections(1) _
> .Headers(wdHeaderFooterFirstPage)
> Set oRng = oHeader.Range
> With oRng
> .InsertAfter vbCr
> .Start = oHeader.Range.End
> .Text = "This is the additional text"
> .End = oHeader.Range.End
> .Font.Size = 16
> .Fields.Update
> End With
>
> To add the text after all headers
>
> Dim oSection As Section
> Dim oHeader As HeaderFooter
> Dim oRng As Range
> For Each oSection In ActiveDocument.Sections
> For Each oHeader In oSection.Headers
> Set oRng = oHeader.Range
> With oRng
> If Len(oRng) > 1 Then
> .InsertAfter vbCr
> End If
> .Start = oHeader.Range.End
> .Text = "This is the additional text"
> .End = oHeader.Range.End
> .Font.Size = 16
> .Fields.Update
> End With
> Next oHeader
> Next oSection
>
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
>
> "Ian B" <ian@(TakeOut)docspro.co.nz> wrote in message
> news:uKC99hn6KHA.3536(a)TK2MSFTNGP04.phx.gbl...
>> Hi
>> I wrote a routine many years ago which has worked fine.
>> I now have to insert another string in the footer using a different font
>> size.
>> I've experimented for hours but my footer always ends up with all footer
>> text at 16 pts.
>> The documents are very large with up to 30 sections so to actually
>> manipulate the footers by opening them and inserting required text is
>> unacceptably slow..
>> See my attempts below:
>> I think I need to introduce a selection into the footer, but the
>> footers(xx) works only with a range and that range seems to be the whole
>> footer.
>>
>> I think I'm "dead in the water", but any help much appreciated.
>>
>> Cheers
>>
>> Ian B
>> ~~~~~~~~~~~~~~
>> With ActiveDocument.Sections(lS).Footers(wdHeaderFooterFirstPage).Range
>> .Paragraphs.TabStops.ClearAll
>> .Font.Size = 8
>> .ParagraphFormat.TabStops.Add Position:=CentimetersToPoints(17),
>> Alignment:=wdAlignTabRight, Leader:=wdTabLeaderSpaces
>> .InsertAfter Text:=sPath & vbTab & "_________Initials" & vbCrLf
>> End With
>>
>> With ActiveDocument.Sections(lS).Footers(wdHeaderFooterPrimary).Range
>> .Font.Size = 16
>> Selection.InsertAfter Text:=sInsertString
>> End With
>>
>>
>>
>
>
>