Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Feb 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word VBA to turn off a Watermark (Word 2000)

    Am trying to create a macro to turn off the Header/Footer Watermark which puts "Draft" on each page.
    The macro produces a runtime error indicating the " The item with the specified name wasn't found" when it gets to the line Selection.HeaderFooter.Shapes("WordArt 2").Select

    Any suggestions

    Thanks

    Sub Macro1()

    '
    If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
    ActiveWindow.Panes(2).Close
    End If
    If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
    ActivePane.View.Type = wdOutlineView Then
    ActiveWindow.ActivePane.View.Type = wdPrintView
    End If
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    Selection.HeaderFooter.Shapes("WordArt 2").Select
    Selection.ShapeRange.Delete
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
    End Sub

  2. #2
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Word VBA to turn off a Watermark (Word 2000)

    The most obvious possibility is that the name is wrong. <img src=/S/grin.gif border=0 alt=grin width=15 height=15>

    Are there multiple shapes in the header? If not, you could just grab the first one by replacing "WordArt 2" with the number 1 (no quotation marks).

  3. #3
    New Lounger
    Join Date
    Feb 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word VBA to turn off a Watermark (Word 2000)

    Thanks very much that solved the issue. However, if there are multiple shapes, how do I know the name of each one. Is it simply the order they appear in the document?
    Thanks agian

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Word VBA to turn off a Watermark (Word 2000)

    Usually, the they are numbered in order of creation. You can use the following macro to see the names of the shapes:

    Sub ListShapes()
    Dim i As Long

    If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
    ActiveWindow.Panes(2).Close
    End If
    If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow. _
    ActivePane.View.Type = wdOutlineView Then
    ActiveWindow.ActivePane.View.Type = wdPrintView
    End If
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader

    For i = 1 To Selection.HeaderFooter.Shapes.Count
    Debug.Print i, Selection.HeaderFooter.Shapes(i).Name
    Next i
    End Sub

    The numbers and names will be listed in the Immediate window (in the Visual Basic Editor)

  5. #5
    New Lounger
    Join Date
    Feb 2005
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word VBA to turn off a Watermark (Word 2000)

    thanks for your help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •