View Single Post
  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Cindy M -WordMVP-
 
Posts: n/a
Default macro produces error message

Hi ?B?S2ltbWllIEI=?=,

First of all, "what Jay said" :-)

Is there a way to know the object name for Word 2003's DRAFT watermark? If
so, I'll see if I can manipulate the VB script to find it.

You can get the name, and set the name, for a Shape using Word's object model.
For example, if the Shape is selected:

MsgBox Selection.ShapeRange.Name
Selection.ShapeRange.Name = "MyDraf****ermark"

It's possible for you to assing a name when the Shape is created/inserted.
Things can get tricky, though, when working with the HeaderFooter area, which
is why I hesitate to just show you some sample code. I'd rather base it on the
code you're already using, but unfortunately you haven't copied that into any
of your messages. OTOH, this is the last time I'll be on-line for some 10
days... So I hope Jay will jump back in and clear things up if I confuse you
:-) (Please note that the better place to ask macro questions is a word.vba
newsgroup or developer, as you'll find more people there conversant with what
you need.)

Dim shp as Word.Shape
Set shp = ActiveDocument.Shapes.AddPicture(arguments go here)
shp.Name = "MyDraf****ermark"

The important thing is to 1. declare the object variable (Dim x as Shape),
then 2. set it to the Shape you're creating, no matter which ADD method you're
using on the Shapes collection. Once you do that, you can change all kinds of
things about the Shape, including the name.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :-)