Thread: [Solved] Problems with Watermark
View Single Post
 
Old 05-25-2012, 04:46 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try the following. It adds your watermark to each header in the first Section of the document. I don't know what the 'PowerPlusWaterMarkObject325783140' watermark is, so I can't test with that. Neither can I test the code with your numerous other variables. You'll note I've used a different naming convention for the watermarks, as they can't all have the same name.
Code:
Dim Shp As appWord.Shape, HdFt As appWord.HeaderFooter
Set Doc = appWord.Documents.Add.Open(NewDoc, , False, False)
With Doc
  'Add the watermark to each header in the first Section
  With .Sections.First
    For Each HdFt In .Headers
      Set Shp = HdFt.Shapes.AddTextEffect(PowerPlusWaterMarkObject325783140, _
        FileType, "Arial Narrow", 38, False, False, 0, 0)
      With Shp
        .Name = "PowerPlusWaterMarkObject" & Format(Now, "YYMMDD") & Format(HdFt.Index, "00")
        .TextEffect.NormalizedHeight = False
        .Line.Visible = False
        .Fill.Visible = True
        .Fill.Solid
        .Fill.ForeColor.RGB = RGB(192, 192, 192)
        .Fill.Transparency = 0.5
        .Rotation = 315
        .LockAspectRatio = True
        .Height = InchesToPoints(3.29)
        .Width = InchesToPoints(6.85)
        .WrapFormat.AllowOverlap = True
        .WrapFormat.Side = wdWrapNone
        .Left = appWord.InchesToPoints(-0.5)
        .WrapFormat.Type = 3
        .RelativeHorizontalPosition = wdRelativeVerticalPositionMargin
        .RelativeVerticalPosition = wdRelativeVerticalPositionMargin
        .Top = InchesToPoints(3)
      End With
      .Range.FormattedText.ShowAll = False
    Next
  End With
  With .ActiveWindow.View
    .ShowMarkupAreaHighlight = False
    .ShowComments = False
    .ShowRevisionsAndComments = False
  End With
  .FormattingShowClear = True
  'Save Document as PDF
  .SaveAs FileName:=NewFName, FileFormat:=wdFormatPDF
  'Close application and document
  .Close False
End With
appWord.Quit
Set Shp = Nothing: Set Doc = Nothing: Set appWord = Nothing
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote