Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / January 2007

Tip: Looking for answers? Try searching our database.

Header watermark throughout document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ricki Miles - 12 Jan 2007 18:55 GMT
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
Doug Robbins - Word MVP - 12 Jan 2007 19:01 GMT
You will need to have your macro iterate through each the Headers in each
Section of the document.

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

>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,
[quoted text clipped - 4 lines]
>
> Ricki
Ricki Miles - 12 Jan 2007 23:50 GMT
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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.