Vishal Monpara's Blog
Knowledge.ToString()

Blog  | Poem  | Article

MS Word: Remove watermark from all Word pages using VBA


You can create watermark in MS Word document by going to Format Menu > Background > Printed Watermarks... Here you will be able to set Text Watermark in each page. Now if you want to remove the watermark from all pages, use the following VBA script.


Dim section As Word.section
Dim pheadertype As Long
Dim hdr As Range
Dim sp As Shape
Dim str As String
For Each section In ActiveDocument.Sections
With section
Set hdr = .Headers(wdHeaderFooterFirstPage).Range
For Each sp In hdr.ShapeRange
str = sp.Name
If InStr(str, "PowerPlusWaterMarkObject") > 0 Then
sp.Visible = msoFalse
End If
Next
Set hdr = .Headers(wdHeaderFooterPrimary).Range
For Each sp In hdr.ShapeRange
str = sp.Name
If InStr(str, "PowerPlusWaterMarkObject") > 0 Then
sp.Visible = msoFalse
End If
Next
End With
Next

Posted On: 03/28/2008 07:17


Feedback

No comments posted yet
Post your comments
Name
Url
Comment

Submit


 

Rate Entry0
( 0 Votes)

 
1 2 3 4 5
Vote
1-Poor 5-Excellent