Answered by:
Adding two custom watermarks to a 2010 word document

Question
-
I would like to add a custom watermark on page one of a Word document. Then on page two another custom watermark. I have created a section break between page one and two and unlinked the two header pages, but still can't get the document to have two different custom watermarks. I end up with one or the other but not both. Is this even possible to do? Thanks for the help.Monday, November 4, 2013 2:51 PM
Answers
-
Assuming you're using Word 2010, try:
Sub Demo()
Dim StrPath As String
StrPath = "C:\Users\" & Environ("UserName") & _
"\AppData\Roaming\Microsoft\Document Building Blocks\1033\14\Built-In Building Blocks.dotx"
With ActiveDocument.Sections.First
.PageSetup.DifferentFirstPageHeaderFooter = True
With .Headers(wdHeaderFooterFirstPage)
Application.Templates(StrPath).BuildingBlockEntries("CONFIDENTIAL 1").Insert Where:=.Range, RichText:=True
End With
With .Headers(wdHeaderFooterPrimary)
Application.Templates(StrPath).BuildingBlockEntries("DO NOT COPY 1").Insert Where:=.Range, RichText:=True
End With
End With
End SubThe path to Built-In Building Blocks.dotx will likely need modifying for other Word versions.
Cheers
Paul Edstein
[MS MVP - Word]- Proposed as answer by TylorWang Wednesday, November 13, 2013 8:44 AM
- Marked as answer by Tony Chen CHN Monday, November 18, 2013 1:06 AM
Wednesday, November 6, 2013 9:46 PM
All replies
-
You don't need a Section break - you need a 'different first page' layout. You can then insert one watermark into the first page and another into the second page. If you're doing this by code, you'll also need to tell Word which header to use in each case.
Cheers
Paul Edstein
[MS MVP - Word]Monday, November 4, 2013 8:49 PM -
I tried that earlier and it just doesn't work. Thanks for trying!Wednesday, November 6, 2013 5:58 PM
-
Assuming you're using Word 2010, try:
Sub Demo()
Dim StrPath As String
StrPath = "C:\Users\" & Environ("UserName") & _
"\AppData\Roaming\Microsoft\Document Building Blocks\1033\14\Built-In Building Blocks.dotx"
With ActiveDocument.Sections.First
.PageSetup.DifferentFirstPageHeaderFooter = True
With .Headers(wdHeaderFooterFirstPage)
Application.Templates(StrPath).BuildingBlockEntries("CONFIDENTIAL 1").Insert Where:=.Range, RichText:=True
End With
With .Headers(wdHeaderFooterPrimary)
Application.Templates(StrPath).BuildingBlockEntries("DO NOT COPY 1").Insert Where:=.Range, RichText:=True
End With
End With
End SubThe path to Built-In Building Blocks.dotx will likely need modifying for other Word versions.
Cheers
Paul Edstein
[MS MVP - Word]- Proposed as answer by TylorWang Wednesday, November 13, 2013 8:44 AM
- Marked as answer by Tony Chen CHN Monday, November 18, 2013 1:06 AM
Wednesday, November 6, 2013 9:46 PM