
Signature
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
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
> You will need to have your macro iterate through each the Headers in each
> Section of the document.
[quoted text clipped - 7 lines]
>>
>> Ricki
Shauna Kelly - 13 Jan 2007 02:09 GMT
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
> Hi Doug,
>
[quoted text clipped - 14 lines]
>>>
>>> Ricki