Thread: [Solved] VBA code to align watermarks
View Single Post
 
Old 11-20-2013, 12:12 PM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,440
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Code:
Sub ScratchMacro() 
   'A basic Word macro coded by Greg Maxey
  Dim Shp As Shape, HdFt As HeaderFooter 
  With ActiveDocument 
     'Add the watermark to each header in the first Section
    With .Sections.First 
      For Each HdFt In .Headers 
        Set Shp = HdFt.Shapes.AddTextEffect(msoTextEffect1, _ 
        "CONFIDENTIAL", "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 
          .WrapFormat.Type = 3 
          .RelativeHorizontalPosition = wdRelativeVerticalPositionPage 
          .RelativeVerticalPosition = wdRelativeVerticalPositionPage 
          .Left = wdShapeCenter 
          .Top = wdShapeCenter 
        End With 
        .Range.FormattedText.ShowAll = False 
      Next 
    End With 
    With .ActiveWindow.View 
      .ShowMarkupAreaHighlight = False 
      .ShowComments = False 
      .ShowRevisionsAndComments = False 
    End With 
    .FormattingShowClear = True 
  End With 
  Set Shp = Nothing 
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/

Last edited by macropod; 11-20-2013 at 01:47 PM. Reason: Added code tags & formatting
Reply With Quote