Results 1 to 9 of 9
  1. #1
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Watermarks on all pages (VB/Word/2003sp1)

    Hi Everyone,

    Have been digging about on this subject and found the code I need in a previous post which works perfectly and does exactly what I need - please see attachment.

    I have to confess, this is all way over my head and given that, I have no idea where to start for what I need to do next. As well as having a macro to create a watermark, I have to create a macro to remove a watermark. How do I go about reversing the effects of above?

    Any help would be much appreciated.

    Many thanks in advance.

    Violet

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

    Re: Watermarks on all pages (VB/Word/2003sp1)

    The beginning of the code removes all watermarks. You could copy it into a separate macro:

    Sub RemoveWatermarks()
    Dim oShape As Shape
    With ActiveDocument.Sections(1).Headers(wdHeaderFooterP rimary)
    If .Shapes.Count > 0 Then
    For Each oShape In .Shapes
    If Left(oShape.Name, 9) = "Watermark" Then oShape.Delete
    Next oShape
    End If
    End With
    End Sub

    Note: this will only remove watermarks created with the macro you attached, not watermarks created another way (for example manually).

  3. #3
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Watermarks on all pages (VB/Word/2003sp1)

    I should've really read the code properly, shouldn't I?!

    Thanks for pointing that out - I'd thought that would be the case for watermarks created using a method alternative to my new macro...I'm sure get around that.

    Thanks very much Hans!

    V

  4. #4
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Watermarks on all pages (VB/Word/2003sp1)

    Me again. I've run into another issue - I have made the font size 80 rather than 96, however, if the text you enter into the input box is longer than say eight characters (e.g., Private & Confidential), it stretches right across the page and disappears at either side. Is there any way I can code in a combo-box rather than an input box, then specify, e.g., if the text = private & confidential, enter a hard return after the & ?

    I hope that makes sense!

    V

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

    Re: Watermarks on all pages (VB/Word/2003sp1)

    For a combo box, you'd need to create a userform in VBA.

    You could tell the users to enter a | where they want a line break:

    ...
    ' Get the watermark string
    sText = InputBox( _
    Prompt:="Enter a string for the watermark" & vbCr & _
    "Use | where you want a line break", _
    Title:="Watermark", _
    Default:="D R A F T")
    ' Get out if string is empty
    If sText = "" Then Exit Sub
    ' Replace | with line break
    sText = Replace(sText, "|", vbCr)
    ...

  6. #6
    2 Star Lounger
    Join Date
    Jun 2002
    Posts
    122
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Watermarks on all pages (VB/Word/2003sp1)

    Thanks Hans, that works. I can't believe it's so difficult to program, if only it were as straightforward as creating the watermark manually!

    Thanks again.

    V

  7. #7
    2 Star Lounger
    Join Date
    Jul 2004
    Location
    Sumner, Washington, USA
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Watermarks on all pages (VB/Word/2003sp1)

    I'm looking for the code referenced in Message 566,955. It is included with the message as an attachment, except the attachment appears to be no longer available. She mentioned that she had found it in a previous message, but I've had no luck finding that, either. Many thanks!

    BTW, I'm looking for this because we've found a bug in Microsoft's 2003/2007 automated watermark feature. In the right circumstances, adding the watermark removes the entire header. Microsoft has been able to replicate the problem, but even if we are able to convince them to work on a hotfix, the time that will take isn't going to work for us. Their recommended work around is to insert the watermarks manually. But since our report documents have multiple sections with different odd/even and different first page headers, that would be a painful process. (If you're interested, I can provide a step-by-step guide to reproducing the problem. I was able to create a scenario that illustrates the problem, but I was unable to pin-point which combination of steps causes it.)

    --Karyl

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

    Re: Watermarks on all pages (VB/Word/2003sp1)

    Many attachments were lost in the server crash of August 2007.

    The code that Violet refers to can be found in the thread beginning at <post:=234,390>post 234,390</post:>. The thread starting at <post:=157,002>post 157,002</post:> may also be of interest.

  9. #9
    2 Star Lounger
    Join Date
    Jul 2004
    Location
    Sumner, Washington, USA
    Posts
    112
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Watermarks on all pages (VB/Word/2003sp1)

    Many thanks! I've copied the code and will experiment this afternoon or tomorrow and see if it resolves our problem.

    --Karyl

Posting Permissions

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