Hi guys,
I am a little bit stuck on how to get round this problem. I am creating a macro to insert a watermark, and I am using Visual Basic to create this macro on Microsoft Word 2010, but I keep getting an error message saying:
Run-time error '-2147024809 (80070057)'
The item with the specific name wasn't found.
I have copied and pasted the code below. and when I click debug, the code it highlights is: Selection.HeaderFooter.Shapes("WordPictureWatermark102522967").Select <- 3rd line down when code starts
-------------------------------------------------------------------------------
Sub Macro1()
'
' Macro1 Macro
'
'
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes("WordPictureWatermark102522967").Select
Selection.Delete
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes.AddPicture(FileName:= _
"G:\A levels\AS ICT Folders\IT2 - PRACTICAL\Task 2 Automated Doc\watermarkimage.jpg" _
, LinkToFile:=False, SaveWithDocument:=True).Select
Selection.ShapeRange.Name = "WordPictureWatermark102632823"
Selection.ShapeRange.PictureFormat.Brightness = 0.85
Selection.ShapeRange.PictureFormat.Contrast = 0.15
Selection.ShapeRange.LockAspectRatio = True
Selection.ShapeRange.Height = CentimetersToPoints(19.5)
Selection.ShapeRange.Width = CentimetersToPoints(18.45)
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
--------------------------------------------------------------------
I have already tried deleting the code: Selection.HeaderFooter.Shapes("WordPictureWatermark102522967").Select
Selection.Delete
...but it just keeps highlighting the line below for all of the code and soon I am left with no code lol.
Can someone please tell me how to resolve this issue?
Thanks
Gamei
I am a little bit stuck on how to get round this problem. I am creating a macro to insert a watermark, and I am using Visual Basic to create this macro on Microsoft Word 2010, but I keep getting an error message saying:
Run-time error '-2147024809 (80070057)'
The item with the specific name wasn't found.
I have copied and pasted the code below. and when I click debug, the code it highlights is: Selection.HeaderFooter.Shapes("WordPictureWatermark102522967").Select <- 3rd line down when code starts
-------------------------------------------------------------------------------
Sub Macro1()
'
' Macro1 Macro
'
'
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes("WordPictureWatermark102522967").Select
Selection.Delete
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ActiveDocument.Sections(1).Range.Select
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.HeaderFooter.Shapes.AddPicture(FileName:= _
"G:\A levels\AS ICT Folders\IT2 - PRACTICAL\Task 2 Automated Doc\watermarkimage.jpg" _
, LinkToFile:=False, SaveWithDocument:=True).Select
Selection.ShapeRange.Name = "WordPictureWatermark102632823"
Selection.ShapeRange.PictureFormat.Brightness = 0.85
Selection.ShapeRange.PictureFormat.Contrast = 0.15
Selection.ShapeRange.LockAspectRatio = True
Selection.ShapeRange.Height = CentimetersToPoints(19.5)
Selection.ShapeRange.Width = CentimetersToPoints(18.45)
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
--------------------------------------------------------------------
I have already tried deleting the code: Selection.HeaderFooter.Shapes("WordPictureWatermark102522967").Select
Selection.Delete
...but it just keeps highlighting the line below for all of the code and soon I am left with no code lol.
Can someone please tell me how to resolve this issue?
Thanks
Gamei