Header watermark throughout document

R

Ricki Miles

I am using Word 2003 and trying to create a macro that will put a copy
watermark on all pages. When I record the macro by choosing Format,
Background, Printed Watermark, etc and then run the macro in a document with
more than one section or a different first page, it only puts the watermark
in that section. How can I edit the code so it will apply to all headers?
Thanks,

Ricki
 
D

Doug Robbins - Word MVP

You will need to have your macro iterate through each the Headers in each
Section of the document.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
R

Ricki Miles

Hi Doug,

Unfortunately, my VBA skills are quite limited and I am not sure how to
write code for this. Could you point me in the right direction? Thanks,

Ricki
 
S

Shauna Kelly

Hi Ricki

You need to loop in two ways: once for each section, and within each
section, once for each header. Like this:

Sub Watermarks()

Dim oSection As Word.Section
Dim oHF As Word.HeaderFooter

For Each oSection In ActiveDocument.Sections
For Each oHF In oSection.Headers

'add the watermark to this header
'in this section

Next oHF
Next oSection

End Sub


However, there have been several threads on these newsgroups from people
saying that they find it difficult to insert watermark-type shapes into
headers and footers. I've experienced the same thing. In particular, Word
sometimes puts two copies of the shape into one section and none in another.
My recent effort at trying to sort this out suggests that it works best if
I:
- start with the cursor at the *end* of the document
- explicitly select the range into which to insert the shape
- try re-paginating the document either before I start the whole thing, or
just before any troublesome bit of code.

And don't set the semi-transparent setting for the reason described here:
http://www.ShaunaKelly.com/word/watermarkletters/index.html

Hope this helps.

Shauna Kelly. Microsoft MVP.
http://www.shaunakelly.com/word
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top