PDA

View Full Version : Remove any Watermark



Fonsi
05-07-2018, 09:21 PM
Hello,

I need a macro to remove the watermark from a Word file (2010).

I have been looking into this but I am not able to create this macro for any watermark, no matter the watermark used in the document.

In other words, what I am looking for is a generic macro that removes the watermarks, without writing in the code the name of the watermark (usually DRAFT, COPY or WHATEVER).

Is this posible?

Many thanks in advance

gmayor
05-08-2018, 03:52 AM
The following should do that (for text watermarks like those mentioned).


Sub RemoveWaterMarks()
'Graham Mayor - http://www.gmayor.com - Last updated - 08 May 2018
Dim oSection As Section
Dim oHeader As HeaderFooter
Dim oRng As Range
Dim oShape As Shape
For Each oSection In ActiveDocument.Sections
For Each oHeader In oSection.Headers
If oHeader.Exists Then
Set oRng = oHeader.Range
oRng.End = oRng.Paragraphs(1).Range.End - 1
For Each oShape In oRng.ShapeRange
If oShape.Type = 15 Then oShape.Delete
Next oShape
End If
Next oHeader
Next oSection
lbl_Exit:
Set oSection = Nothing
Set oHeader = Nothing
Set oRng = Nothing
Set oShape = Nothing
Exit Sub
End Sub

Fonsi
05-09-2018, 03:08 AM
Thank you so much! It works on any document!