Consulting

Results 1 to 3 of 3

Thread: Remove any Watermark

  1. #1
    VBAX Newbie
    Joined
    May 2018
    Posts
    5
    Location

    Remove any Watermark

    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

  2. #2
    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
    Graham Mayor - MS MVP (Word)
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

  3. #3
    VBAX Newbie
    Joined
    May 2018
    Posts
    5
    Location
    Thank you so much! It works on any document!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •