brother thanks for the help, I place the code "Format (Now," dd / mm / yyyy ") but not displayed in the document. Annex picture

I know why this happens


word.JPG

Quote Originally Posted by gmayor View Post
The following method re-purposes a built-in building block to add the data in the first page header:

Sub InsertDateWatermark()
Dim oRng As Range
Dim oHeader As HeaderFooter
Dim oTemplate As Template
    ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True
    Set oHeader = ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage)
    Set oRng = oHeader.Range
    On Error Resume Next
    For Each oTemplate In Application.Templates
        If oTemplate.name Like "Built-In Building Blocks*" Then
            oTemplate.BuildingBlockEntries("CONFIDENTIAL 1").Insert Where:=oRng, _
                                                                    RichText:=True
        End If
    Next oTemplate
    With oRng.ShapeRange.Item(1)
        .TextEffect.Text = Format(Date, "Short Date")
        .TextEffect.FontSize = 24
        .Height = 29.25
        .Width = 102#
    End With
lbl_Exit:
    Exit Sub
End Sub
To remove it
Sub RemoveDateWatermark()
Dim oRng As Range
Dim oHeader As HeaderFooter
    On Error Resume Next
    ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter = True
    Set oHeader = ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage)
    Set oRng = oHeader.Range
    oRng.ShapeRange.Item(1).Delete
lbl_Exit:
    Exit Sub
End Sub