Headers/footers

Adding text to the header
With ActiveDocument.ActiveWindow.View 
        .SeekView = wdSeekCurrentPageHeader 
        Selection.HeaderFooter.Range.Text = "Header text" 
        .SeekView = wdSeekMainDocument 
    End With

Selecting the primary footer of the first section of the document and delete it
Dim rngFooter As Range 
    Set rngFooter = ActiveDocument.Sections(1) _ 
        .Footers(wdHeaderFooterPrimary).Range 
    With rngFooter 
        .Delete         
    End With 

After deleting the text, add filename field, two tabs and author field
.Fields.Add Range:=rngFooter, Type:=wdFieldFileName, Text:="\p" 
        .InsertAfter Text:=vbTab &; vbTab 
        .Collapse Direction:=wdCollapseStart 
        .Fields.Add Range:=rngFooter, Type:=wdFieldAuthor 

Comments

Popular posts from this blog

Find and replace

Menus and toolbars

Formatting