Fields in WordArt

A

Alex

Hi Everyone

I currently have a textbox with a {docproperty Title}
field inserted in the header&footers of my documents.
This acts as an aoutomatically updating watermark.

What I'd like to do (due to increased formatting options)
is insert the field into a WordArt watermark.
Unfortunately, WordArt does allow fields to be inserted
into the edit text box.

I currently have a vba userform that changes the value of
the Title & Subject properties fields, plus some custom
property fields and then refreshes all the fields in all
the story ranges.

So is there some way using vba to get the contents (value)
of any word field into WordArt.

Big thank you in advance

Al
 
J

Jay Freedman

Hi Al

Try this. You may need to make some changes if you have watermarks in
multiple sections or header types, or if the watermark isn't the first shape
in the header. Other modifications should be pretty easy to see.

Sub UpdateWatermark()
Dim oWM As Shape

With ActiveDocument.Sections(1) _
.Headers(wdHeaderFooterPrimary)
If .Shapes.Count > 0 Then
Set oWM = .Shapes(1)
Else
Set oWM = .Shapes.AddTextEffect( _
PresetTextEffect:=msoTextEffect2, _
Text:=" ", _
FontName:="Arial", _
FontSize:=36, _
FontBold:=msoTrue, _
FontItalic:=msoFalse, _
Left:=0, Top:=0, _
Anchor:=.Range)
End If
End With

If oWM.Type = msoTextEffect Then
With oWM
.TextEffect.Text = ActiveDocument _
.BuiltInDocumentProperties("Title").Value
.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionPage
.RelativeVerticalPosition = _
wdRelativeVerticalPositionPage
.Left = InchesToPoints(1.25)
.Top = InchesToPoints(2)
.Width = InchesToPoints(6)
.Height = InchesToPoints(6)
.Fill.Transparency = 0.75
.Line.Visible = msoFalse
End With
End If

Set oWM = Nothing
End Sub
 
C

Cindy M -WordMVP-

Hi Alex,
So is there some way using vba to get the contents (value)
of any word field into WordArt.
Yes, VBA can do this :)

The TextEffect property of a Shape or InlineShape object affects the text displayed in Word Art. So, something like this:
rng.InlineShapes(1).TextEffect.Text = doc.Variables("xyz").Value
I currently have a textbox with a {docproperty Title}
field inserted in the header&footers of my documents.
This acts as an aoutomatically updating watermark.

What I'd like to do (due to increased formatting options)
is insert the field into a WordArt watermark.
Unfortunately, WordArt does allow fields to be inserted
into the edit text box.

I currently have a vba userform that changes the value of
the Title & Subject properties fields, plus some custom
property fields and then refreshes all the fields in all
the story ranges.

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

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