J
jerem
It is amazing how long one can meander through Intellisense trying to find
out how to do one simple thing? Mama Mia!! You come across something that
looks hopeful only to try it and realize Ooops, Object missing or some thing
or other on that line. So after a good long effort (and a considerable
amount of time down the drain) I'm throwing in the towel and asking Doug,
Graham, Greg or anyone else who comes upon this first:
Here's the code:
Dim oRng As Range
Dim oSection As Section
Dim oFooter As HeaderFooter
Call SameAsPrevious
For Each oSection In ActiveDocument.Sections
For Each oFooter In oSection.Footers
If oFooter.Exists Then
Set oRng = oFooter.Range
With oRng
Fields.Add oRng, wdFieldFileName
.Collapse wdCollapseEnd
.ParagraphFormat.Alignment = _
wdAlignParagraphLeft
End With
oFooter.Range.Paragraphs(1).Range.Font.Size = 8
End If
Next oFooter
Next oSection
End Sub
In a previous communication with Doug he'd given me various solutions for
FileName and Page Numbering. I've split some of the code up to give me just
a FileName in the footers, just Page Numbering in the Footers, a FileName and
Page Numbering and a few other variations which I've placed in a menu on a
toolbar. There's just one more variation I need and that is placing the
FileName in the Footer (which is accomplished by the above code) but placed
in there without deleting what already exists in the footer. I need the
FileName to be inserted at the very end of the Footer. Thanks in advance for
your help.
out how to do one simple thing? Mama Mia!! You come across something that
looks hopeful only to try it and realize Ooops, Object missing or some thing
or other on that line. So after a good long effort (and a considerable
amount of time down the drain) I'm throwing in the towel and asking Doug,
Graham, Greg or anyone else who comes upon this first:
Here's the code:
Dim oRng As Range
Dim oSection As Section
Dim oFooter As HeaderFooter
Call SameAsPrevious
For Each oSection In ActiveDocument.Sections
For Each oFooter In oSection.Footers
If oFooter.Exists Then
Set oRng = oFooter.Range
With oRng
Fields.Add oRng, wdFieldFileName
.Collapse wdCollapseEnd
.ParagraphFormat.Alignment = _
wdAlignParagraphLeft
End With
oFooter.Range.Paragraphs(1).Range.Font.Size = 8
End If
Next oFooter
Next oSection
End Sub
In a previous communication with Doug he'd given me various solutions for
FileName and Page Numbering. I've split some of the code up to give me just
a FileName in the footers, just Page Numbering in the Footers, a FileName and
Page Numbering and a few other variations which I've placed in a menu on a
toolbar. There's just one more variation I need and that is placing the
FileName in the Footer (which is accomplished by the above code) but placed
in there without deleting what already exists in the footer. I need the
FileName to be inserted at the very end of the Footer. Thanks in advance for
your help.