How do I call Print Watermark dialog box

G

Gill

Does anyone know the vba code to display the "Print
Watermark" dialog box generally accessed from Format >
Background > Printed Watermark. It appears that you
can't access this object in either vba or by trying to
assign a keyboard shortcut.

Version bying used - Word XP 2002

Thanks in advance to anyone that can shed some light on
this.
 
H

Harold

The Print Watermark dialog is not exposed via VBA.
You can create a Watermark programmatically.
If you want to give the user a dialog to choose the picture or text, you
could use a VBA Userform to simulate the builtin dialog.

The easiest way to get the syntax to add a Watermark is to record a macro
then review it and modify it as needed.
This is the results of the recorded macro (the names were changed to protect
the guilty)
Sub AddWaterMark()
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes.AddPicture(FileName:= _
"C:\Documents and Settings\[userName\My Documents\My
Pictures\xxxx.png" _
, LinkToFile:=False, SaveWithDocument:=True).Select
Selection.ShapeRange.Name = "WordPictureWatermark1"
Selection.ShapeRange.PictureFormat.Brightness = 0.85
Selection.ShapeRange.PictureFormat.Contrast = 0.15
Selection.ShapeRange.LockAspectRatio = True
Selection.ShapeRange.Height = InchesToPoints(7.77)
Selection.ShapeRange.Width = InchesToPoints(6)
Selection.ShapeRange.WrapFormat.AllowOverlap = True
Selection.ShapeRange.WrapFormat.Side = wdWrapNone
Selection.ShapeRange.WrapFormat.Type = 3
Selection.ShapeRange.RelativeHorizontalPosition = _
wdRelativeVerticalPositionMargin
Selection.ShapeRange.RelativeVerticalPosition = _
wdRelativeVerticalPositionMargin
Selection.ShapeRange.Left = wdShapeCenter
Selection.ShapeRange.Top = wdShapeCenter
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub

regards,
 
W

Word Heretic

G'day "Gill" <[email protected]>,

I think its just a shape in the header isn't it?


Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Gill reckoned:
 
G

Gill Hawks

Thanks for this. I have been able to do this but problems
arise when you want the watermark to go onto a document
with multiple sections and added to that headers within
those sections aren't linked and are all quite
different. The built in feature seems to cope with this
perfectly however, its very difficult to write code to
accomodate. Oh well - I'll keep trying with own code to
do same. It seems a shame that Microsoft doesn't give
access to the dialog box.

-----Original Message-----
The Print Watermark dialog is not exposed via VBA.
You can create a Watermark programmatically.
If you want to give the user a dialog to choose the picture or text, you
could use a VBA Userform to simulate the builtin dialog.

The easiest way to get the syntax to add a Watermark is to record a macro
then review it and modify it as needed.
This is the results of the recorded macro (the names were changed to protect
the guilty)
Sub AddWaterMark()
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes.AddPicture(FileName:= _
"C:\Documents and Settings\[userName\My Documents\My
Pictures\xxxx.png" _
, LinkToFile:=False, SaveWithDocument:=True).Select
Selection.ShapeRange.Name = "WordPictureWatermark1"
Selection.ShapeRange.PictureFormat.Brightness = 0.85
Selection.ShapeRange.PictureFormat.Contrast = 0.15
Selection.ShapeRange.LockAspectRatio = True
Selection.ShapeRange.Height = InchesToPoints(7.77)
Selection.ShapeRange.Width = InchesToPoints(6)
Selection.ShapeRange.WrapFormat.AllowOverlap = True
Selection.ShapeRange.WrapFormat.Side = wdWrapNone
Selection.ShapeRange.WrapFormat.Type = 3
Selection.ShapeRange.RelativeHorizontalPosition = _
wdRelativeVerticalPositionMargin
Selection.ShapeRange.RelativeVerticalPosition = _
wdRelativeVerticalPositionMargin
Selection.ShapeRange.Left = wdShapeCenter
Selection.ShapeRange.Top = wdShapeCenter
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub

regards,

--
Harold Kless, MCSD
Support Professional
Microsoft Technical Support for Business Applications
(e-mail address removed)

--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


Gill said:
Does anyone know the vba code to display the "Print
Watermark" dialog box generally accessed from Format >
Background > Printed Watermark. It appears that you
can't access this object in either vba or by trying to
assign a keyboard shortcut.

Version bying used - Word XP 2002

Thanks in advance to anyone that can shed some light on
this.


.
 
G

Gill Hawks

I can easily add shape to header but its more difficult
when you want to add shapes to a document with multiple
headers that arn't linked to each other. I'm fairly sure
that you can't access the built in Watermark Feature and
just wanted to know if anyone else ghad been able to do
this.
 
W

Word Heretic

G'day "Gill Hawks" <[email protected]>,

Your surmises sound correct. You just iterate every section in the
appropriate storyranges, or iterate every headerandfooter in each
section.

Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com

steve from wordheretic.com (Email replies require payment)


Gill Hawks reckoned:
 
S

Stuart

HI Gill,
I was able to display the 'Printed Watermark' dialogbox with the following line of code:
Commandbars("Menu").controls.Item("Format").Controls.Item("Background").controls.Item("Printed Watermark...").Execute
From then on, it's all manual
 

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