M
Myoshia
I currently have a macro that pulls in external information into the
footer(s) of my document and thus far, the information comes over just fine.
However, I am not familiar enough with VBA to:
1. make sure that the info appears in EVERY footer (whether the section is
set to Different First Page or not)
2. make sure that if there is existing text in my footer (most commonly a
page number), that it doesn't get wiped out (I'm assuming by the .range).
Again, I'm not familiar enough with VBA to tell it to only remove that which
is beyond the first line (which is quite often where the page number
appears). Here's the code I am currently using:
Dim objRange As Word.Range
Dim objFont As Word.Font
Set objRange =
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
Set objFont = objRange.Font
objRange.Style = wdStyleFooter
objRange.Text = strTextString
With objFont
.Size = 8
End With
If ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Exists =
True Then
ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage).Range.Text _
= strTextString
End If
Set objRange = Nothing
Set objFont = Nothing
End Sub
I hope this is not confusing. Please advise and thanks in advance.
footer(s) of my document and thus far, the information comes over just fine.
However, I am not familiar enough with VBA to:
1. make sure that the info appears in EVERY footer (whether the section is
set to Different First Page or not)
2. make sure that if there is existing text in my footer (most commonly a
page number), that it doesn't get wiped out (I'm assuming by the .range).
Again, I'm not familiar enough with VBA to tell it to only remove that which
is beyond the first line (which is quite often where the page number
appears). Here's the code I am currently using:
Dim objRange As Word.Range
Dim objFont As Word.Font
Set objRange =
ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Range
Set objFont = objRange.Font
objRange.Style = wdStyleFooter
objRange.Text = strTextString
With objFont
.Size = 8
End With
If ActiveDocument.Sections(1).Footers(wdHeaderFooterPrimary).Exists =
True Then
ActiveDocument.Sections(1).Footers(wdHeaderFooterFirstPage).Range.Text _
= strTextString
End If
Set objRange = Nothing
Set objFont = Nothing
End Sub
I hope this is not confusing. Please advise and thanks in advance.