Word 2010 VBA add watermark

G

Greg Lovern

If I add a watermark to a document in Word 2010, the watermark works
fine and prints fine but if I go into Page Layout | Page Background |
Watermark | Custom Watermark, which displays the "Printed Watermark"
dialog, the dialog says "No Watermark".

Is there a way to add a watermark in VBA that will get that dialog to
indicate that a watermark is in place?


Sub AddTheWatermark()
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes.AddTextEff… _
PowerPlusWaterMarkObject, "DRAFT", "Arial", 1, False, False, 0, 0 _
).Select
With Selection.ShapeRange
..TextEffect.NormalizedHeight = False
..Line.Visible = False
..Fill.Visible = True
..Fill.Solid
..Fill.ForeColor.RGB = RGB(192, 192, 192)
..Fill.Transparency = 0.5
..Rotation = 315
..LockAspectRatio = True
..Height = CentimetersToPoints(6.41)
..Width = CentimetersToPoints(16.03)
..WrapFormat.AllowOverlap = True
..WrapFormat.Side = wdWrapNone
..WrapFormat.Type = 3
..RelativeHorizontalPosition = _
wdRelativeVerticalPositionMargin
..RelativeVerticalPosition = _
wdRelativeVerticalPositionMargin
..Left = wdShapeCenter
..Top = wdShapeCenter
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
 
P

peter

Dne sobota, 25. Äervna 2011 1:31:53 UTC+2 Joe Plumb napsal(a):
Looks like some of your code is cutoff, is this the full line:
Selection.HeaderFooter.Shapes.AddTextEff… _
PowerPlusWaterMarkObject, "DRAFT", "Arial", 1, False, False, 0, 0 _
).Select

???

Joe

Hi Joe,
i update this simple err.

Sub AddTheWatermark()
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes.AddTextEffect( _
PowerPlusWaterMarkObject, "DRAFT", "Arial", 1, False, False, 0, 0 _
).Select
With Selection.ShapeRange
..TextEffect.NormalizedHeight = False
..Line.Visible = False
..Fill.Visible = True
..Fill.Solid
..Fill.ForeColor.RGB = RGB(192, 192, 192)
..Fill.Transparency = 0.5
..Rotation = 315
..LockAspectRatio = True
..Height = CentimetersToPoints(6.41)
..Width = CentimetersToPoints(16.03)
..WrapFormat.AllowOverlap = True
..WrapFormat.Side = wdWrapNone
..WrapFormat.Type = 3
..RelativeHorizontalPosition = _
wdRelativeVerticalPositionMargin
..RelativeVerticalPosition = _
wdRelativeVerticalPositionMargin
..Left = wdShapeCenter
..Top = wdShapeCenter
End With
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
 

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