[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 875
  • Last Modified:

Macro to Create Watermark in every section

I have a user that uses a watermark called "Specimen" on a multitude of documents but it tired of having to constantly type this in as it is not a normal watermark.  I've created a basic macro for her to use, but any time she has the different first page option checked the macro doesn't work.  The language is below.  Any help would be greatly appreciated.

Angela Gallo
Desktop Services Manager
McNair Law Firm, PA
Columbia, SC

Sub Specimen()
'
' Specimen Macro
' Macro recorded 8/24/2004 by Angela C Gallo
'
    ActiveDocument.Sections(1).Range.Select
    ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
    Selection.HeaderFooter.Shapes.AddTextEffect(PowerPlusWaterMarkObject1, _
        "SPECIMEN", "Times New Roman", 1, False, False, 0, 0).Select
    Selection.ShapeRange.Name = "PowerPlusWaterMarkObject1"
    Selection.ShapeRange.TextEffect.NormalizedHeight = False
    Selection.ShapeRange.Line.Visible = False
    Selection.ShapeRange.Fill.Visible = True
    Selection.ShapeRange.Fill.Solid
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(192, 192, 192)
'   Selection.ShapeRange.Fill.Transparency = 0
    Selection.ShapeRange.Rotation = 315
    Selection.ShapeRange.LockAspectRatio = True
    Selection.ShapeRange.Height = InchesToPoints(1.67)
    Selection.ShapeRange.Width = InchesToPoints(7.5)
    Selection.ShapeRange.WrapFormat.AllowOverlap = False
    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
    ActiveWindow.ActivePane.SmallScroll Down:=9
End Sub
0
Bonilas
Asked:
Bonilas
  • 7
  • 5
1 Solution
 
Joanne M. OrzechManager, Document Services CenterCommented:
I'm sure I could help you but I what is PowerPlusWaterMarkObject1?

I get an error message.  What is it?  Just a watermark?
0
 
BonilasAuthor Commented:
Yes, it's just a watermark.  When I created the macro originally, I created using the record feature and when I went into the Format | Background | Printed Watermark section and typed Specimen in, that's the object tytle it created.
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
Maybe you can work with this macro and replace what I put in for your proper watermark:

Sub Specimen()
    Selection.HomeKey
    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.AddTextEffect(msoTextEffect2, "SPECIMEN", _
        "Arial Black", 60#, msoFalse, msoFalse, 130.5, 108.25).Select
    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.WholeStory
    Selection.Copy
    ActiveWindow.ActivePane.View.NextHeaderFooter
    Selection.Paste
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub

It works for me!
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
BonilasAuthor Commented:
My Help Desk person is estatic, it works wonderfully.  Thank you so much.

Angela Gallo
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
Well - I am SOOOOOOOOOOO pleased!  
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
Bonilas - if my answer provided the correct solution, then you need to close the question by clicking on the accept button next to the proper answer.  Thanks.

Joanne

P.S. - I've worked for lawyers since June 71! (see profile)  I feel your pain :)
0
 
BonilasAuthor Commented:
Wow! I'll bet you do know. Thanks again for the help and so quickly too.  I look forward to talking with you in the future.

Angela
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
Glad to help Angela! Thanks for the points and grade.   Look forward to your next visit here :)
0
 
BonilasAuthor Commented:
Joanne, one more question.   How can I lighten the shade or change the color?
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
Try this:

Sub Specimen()
    Selection.HomeKey Unit:=wdStory
    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.AddTextEffect(msoTextEffect2, "SPECIMEN", _
        "Arial Black", 60#, msoFalse, msoFalse, 166.5, 150.75).Select
    Selection.ShapeRange.Fill.Visible = msoTrue
    Selection.ShapeRange.Fill.Solid
    Selection.ShapeRange.Fill.ForeColor.RGB = RGB(192, 192, 192)
    Selection.ShapeRange.Fill.Transparency = 0#
    Selection.ShapeRange.Line.Weight = 0.75
    Selection.ShapeRange.Line.DashStyle = msoLineSolid
    Selection.ShapeRange.Line.Style = msoLineSingle
    Selection.ShapeRange.Line.Transparency = 0#
    Selection.ShapeRange.Line.Visible = msoFalse
    Selection.ShapeRange.LockAspectRatio = msoFalse
    Selection.ShapeRange.Height = 151.9
    Selection.ShapeRange.Width = 279.35
    Selection.ShapeRange.Rotation = 0#
    Selection.ShapeRange.RelativeHorizontalPosition = _
        wdRelativeHorizontalPositionColumn
    Selection.ShapeRange.RelativeVerticalPosition = _
        wdRelativeVerticalPositionParagraph
    Selection.ShapeRange.Left = wdShapeCenter
    Selection.ShapeRange.Top = InchesToPoints(1.59)
    Selection.ShapeRange.LockAnchor = False
    Selection.ShapeRange.WrapFormat.AllowOverlap = True
    Selection.ShapeRange.WrapFormat.Side = wdWrapLargest
    Selection.ShapeRange.WrapFormat.DistanceTop = InchesToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceBottom = InchesToPoints(0)
    Selection.ShapeRange.WrapFormat.DistanceLeft = InchesToPoints(0.13)
    Selection.ShapeRange.WrapFormat.DistanceRight = InchesToPoints(0.13)
    Selection.ShapeRange.WrapFormat.Type = 3
    Selection.ShapeRange.ZOrder 4
    Selection.WholeStory
    Selection.WholeStory
    Selection.Copy
    ActiveWindow.ActivePane.View.NextHeaderFooter
    Selection.Paste
    ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub
0
 
BonilasAuthor Commented:
Perfect.  Thanks again.
0
 
Joanne M. OrzechManager, Document Services CenterCommented:
:)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now