Inserting WordArt In Headers

J

Jon Le Long

I am trying to programmatically insert a WordArt object
into all the headers in all the sections of a document. I
am using the following code:

For Each mySection In ActiveDocument.Sections
If
ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter
Then
Set FirstPageWatermark = mySection.Headers
(wdHeaderFooterFirstPage).Shapes.AddTextEffect
(msoTextEffect2, "test", "Arial Black", 36, msoFalse,
msoFalse, 0, 0, mySection.Headers
(wdHeaderFooterFirstPage).Range)
End If
Set PrimaryWatermark = mySection.Headers
(wdHeaderFooterPrimary).Shapes.AddTextEffect
(msoTextEffect2, "test", "Arial Black", 36, msoFalse,
msoFalse, 0, 0, mySection.Headers
(wdHeaderFooterPrimary).Range)
Next

In a document set to use a different first page, the
result I get is that there are two WordArt objects on the
first page and none on the subsequent pages. I suspected
it was down to the Anchor property of the shape, but I
have messed about with various settings to no avail.

I know it can be done using SeekView and moving around
the document, but that does not seem very elegant to me -
especially when you have to put the document in print
layout first and then put it back to whatever the user
had originally, etc.

Anyone got any better ideas?
 
W

Word Heretic

G'day "Jon Le Long" <[email protected]>,

if pagelayout.this then do header(that)


I am trying to programmatically insert a WordArt object
into all the headers in all the sections of a document. I
am using the following code:

For Each mySection In ActiveDocument.Sections
If
ActiveDocument.PageSetup.DifferentFirstPageHeaderFooter
Then
Set FirstPageWatermark = mySection.Headers
(wdHeaderFooterFirstPage).Shapes.AddTextEffect
(msoTextEffect2, "test", "Arial Black", 36, msoFalse,
msoFalse, 0, 0, mySection.Headers
(wdHeaderFooterFirstPage).Range)
End If
Set PrimaryWatermark = mySection.Headers
(wdHeaderFooterPrimary).Shapes.AddTextEffect
(msoTextEffect2, "test", "Arial Black", 36, msoFalse,
msoFalse, 0, 0, mySection.Headers
(wdHeaderFooterPrimary).Range)
Next

In a document set to use a different first page, the
result I get is that there are two WordArt objects on the
first page and none on the subsequent pages. I suspected
it was down to the Anchor property of the shape, but I
have messed about with various settings to no avail.

I know it can be done using SeekView and moving around
the document, but that does not seem very elegant to me -
especially when you have to put the document in print
layout first and then put it back to whatever the user
had originally, etc.

Anyone got any better ideas?

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email (e-mail address removed)
Products http://www.geocities.com/word_heretic/products.html

Replies offlist may require payment.
 
C

Cindy Meister -WordMVP-

Hi Jon,

Specify a paragraph.RANGE in the header or footer RANGE.

Word stores the info for all SHAPE objects in the primary
header storage. So you have to specify a RANGE for the
ANCHOR point.
In a document set to use a different first page, the
result I get is that there are two WordArt objects on the
first page and none on the subsequent pages. I suspected
it was down to the Anchor property of the shape, but I
have messed about with various settings to no avail.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jan
24 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 

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