Good evening, after 2 hours reading, learning and revising the forum, learned how to set the date by a variable, then when I want to delete the date instead of using the code to delete all header, specific clear the variable, leave the code in case anyone needs
Sub AddFechaWaterMark()
Dim strWMName As String
ActiveDocument.Sections(1).Range.Select
strWMName = ActiveDocument.Sections(1).Index
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes.AddTextEffect( _
PowerPlusWaterMarkObject244368608, " " & _
Format(Now(), "dd/mm/yyyy"), "Arial", _
1, False, False, 0, 0).Select
Selection.ShapeRange.TextEffect.NormalizedHeight = False
Selection.ShapeRange.Line.Visible = False
Selection.ShapeRange.Fill.Visible = True
Selection.ShapeRange.Fill.Solid
Selection.ShapeRange.Fill.ForeColor.RGB = RGB(192, 192, 192)
Selection.ShapeRange.Name = strWMName
Selection.ShapeRange.Fill.Transparency = 0.4
Selection.ShapeRange.Rotation = 315
Selection.ShapeRange.LockAspectRatio = True
Selection.ShapeRange.Height = CentimetersToPoints(6.1)
Selection.ShapeRange.Width = CentimetersToPoints(4.34)
Selection.ShapeRange.WrapFormat.AllowOverlap = True
Selection.ShapeRange.WrapFormat.Side = wdWrapNone
Selection.ShapeRange.WrapFormat.Type = 6
Selection.ShapeRange.RelativeHorizontalPosition = _
wdRelativeVerticalPositionMargin
Selection.ShapeRange.RelativeVerticalPosition = _
wdRelativeVerticalPositionMargin
Selection.ShapeRange.Left = wdShapeCenter
Selection.ShapeRange.Top = wdShapeCenter
Selection.ShapeRange.IncrementTop 55
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
Sub DeleteFechaWaterMark()
Dim strWMName As String
On Error GoTo ErrHandler
ActiveDocument.Sections(1).Range.Select
strWMName = ActiveDocument.Sections(1).Index
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes(strWMName).Select
Selection.Delete
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
Exit Sub
ErrHandler:
MsgBox "An error occured trying to remove the watermark." & Chr(13) & _
"Error Number: " & Err.Number & Chr(13) & _
"Decription: " & Err.Description, vbOKOnly + vbCritical, "Error"
End Sub
Samt: Annex to the document, a question to finish my custom watermark will say how can I do to insert an image as a watermark placed using VBA, in the same way that the annex to the just that using VBA
the truth is an excellent forum I hope to open a section for people who speak Spanish xD haha