In new to this so im trying to muddle my way through.
I have the following code
Code:
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes.AddPicture(Filename: =PathOfFile _
, 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 = CentimetersToPoints(13.16)
Selection.ShapeRange.Width = CentimetersToPoints(17.55)
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
This puts a watermark picture into a document with the shaperange name of "WordPictureWatermark1" right?
If it does I need to be able at a later date determine if this shaperange already exists because the user may need to change the watermark. I know how to delete it.
Code:
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes("WordPictureWatermark1").Select
Selection.Delete
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
But how do I find out if the things exists in the first place!
Because if I try to delete when it isnt there in the first place it chucks a wobbley (and rightly so)
is there something like ActiveDocument.Header.Shapes("WordPictureWatermark1").Exists??
any help is greatly appreciated