View Single Post
 
Old 10-22-2019, 11:06 PM
digitalelise digitalelise is offline Mac OS X Office 2016
Novice
 
Join Date: Oct 2019
Posts: 2
digitalelise is on a distinguished road
Question Adding text to the header and footer without removing all other content in the header and footer

Hi Folks,

I am new to macros and VBA but muddling my way through.

I am trying to add some text to the documents header and footer but want the two images that are in the template to stay.

When ever I hit the button SetClassification it adds the text but removes all other content in the header and footer.

Any assistance in making this work would be appreciated. I think I am at the edge of my knowledge but so close to having it work perfectly.


Code:
Private Sub cmdSetClassification_Click()

' prepare header footers..
'Dim sHeadFooter As String
'sHeadFooter = Me.txtFurtherInfo.Text

With ActiveDocument.Sections(1)

 .Headers(wdHeaderFooterPrimary).Range.Text = sHeaderFooter
 .Headers(wdHeaderFooterPrimary).Range.Paragraphs.Alignment = wdAlignParagraphCenter
 .Headers(wdHeaderFooterPrimary).Range.Paragraphs.LeftIndent = 76
 .Headers(wdHeaderFooterPrimary).Range.Font.ColorIndex = wdRed
 .Headers(wdHeaderFooterPrimary).Range.Font.Name = "Gotham Book"
 .Headers(wdHeaderFooterPrimary).Range.Font.Size = 10
 
 .Footers(wdHeaderFooterPrimary).Range.Text = sHeaderFooter
 .Footers(wdHeaderFooterPrimary).Range.Paragraphs.Alignment = wdAlignParagraphCenter
 .Footers(wdHeaderFooterPrimary).Range.Font.ColorIndex = wdRed
 .Footers(wdHeaderFooterPrimary).Range.Font.Name = "Gotham Book"
 .Footers(wdHeaderFooterPrimary).Range.Font.Size = 10
 
End With

Unload Me

End Sub
Attached Files
File Type: dotm template_V02.dotm (22.8 KB, 12 views)
Reply With Quote