K
Kerri
I am in desperate need of another pair of eyes. I am
working in Word 2000 and have a macro that creates a
Watermark using wordart. This is the 3rd version. The
previous version worked find as long as there wasn't
sections or Diff. first page. So, in this version I have
incorporated oSection and oHeader to have it loop through
each section of the document. Which works great when
there 'are' multiple sections.
Problem: I have a lot of documents with Different first
page marked and it might or might not have additional
sections. In this situation it only puts the watermark on
a single page or makes the 1st page correct and all other
pages dont have my formatting of the wordart object. It
could be just a placement thing...I just don't know.
Perv. version - i named the shape .name = "draft1" in this
version it is not possible to name the shape so you can
delete "only" that shape.
I am a novice...and learn by trial and error as well as
searching all the news groups. The "oSection" options I
added came from this posting: 7-2-2001
microsoft.public.word.vab.general Subject:NextHeaderFooter
Any help is greatly appreciated.
Thank you!
Sub DRAFTWaterMark()
Dim i As Integer
Dim oSection As Section, oHeader As HeaderFooter, oShape
As Shape, MyRange As Range
' AddTextEffect fails unless the view is in the header:
ActiveWindow.View.Type = wdPageView
Selection.EndKey Unit:=wdStory
' ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
ActiveWindow.ActivePane.View.SeekView =
wdSeekFirstPageHeader
For Each oSection In ActiveDocument.Sections
For Each oHeader In oSection.Headers
If oHeader.Exists Then
Set MyRange = oHeader.Range
oHeader.Shapes.AddTextEffect
(msoTextEffect8, "Draft Copy", _
"Times New Roman", 36#, msoFalse,
msoFalse, 226.3, 157.7, MyRange).Select
With oHeader.Range.ShapeRange
If .Count >= 1 Then 'This makes the first
page different than the rest of the pages??
.Fill.Solid
.Fill.ForeColor.RGB = RGB(192, 192, 192)
'Lighter Grey color
'.Fill.ForeColor.RGB = RGB(221, 221, 221)
.Fill.Transparency = 0#
.Line.Weight = 0.75
.Line.DashStyle = msoLineSolid
.Line.Style = msoLineSingle
.Line.Transparency = 0#
.Line.Visible = msoFalse
.LockAspectRatio = msoFalse
.Height = 81.35
.Width = 360#
.Rotation = 0#
.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionPage
.RelativeVerticalPosition = _
wdRelativeVerticalPositionPage
.Left = wdShapeCenter
.Top = wdShapeCenter
.LockAnchor = True
.WrapFormat.AllowOverlap = True
.WrapFormat.Side = wdWrapBoth
.WrapFormat.DistanceTop = InchesToPoints(0)
.WrapFormat.DistanceBottom = InchesToPoints
(0)
.WrapFormat.DistanceLeft = InchesToPoints
(0.13)
.WrapFormat.DistanceRight = InchesToPoints
(0.13)
.WrapFormat.Type = 3
.ZOrder 5
.Shadow.Visible = msoFalse
End If
End With
End If
Next oHeader
Next oSection
ActiveWindow.ActivePane.View.SeekView =_
wdSeekMainDocument
End Sub
'--------------
Sub DeleteDraftWatermark()
'I would like it to delete only the shapes inserted
above...but no such luck.
For Each Section In ActiveDocument.Sections
For Each header In Section.Headers
For Each Shape In header.Shapes
Shape.Delete
Next
Next
Next
End Sub
working in Word 2000 and have a macro that creates a
Watermark using wordart. This is the 3rd version. The
previous version worked find as long as there wasn't
sections or Diff. first page. So, in this version I have
incorporated oSection and oHeader to have it loop through
each section of the document. Which works great when
there 'are' multiple sections.
Problem: I have a lot of documents with Different first
page marked and it might or might not have additional
sections. In this situation it only puts the watermark on
a single page or makes the 1st page correct and all other
pages dont have my formatting of the wordart object. It
could be just a placement thing...I just don't know.
Perv. version - i named the shape .name = "draft1" in this
version it is not possible to name the shape so you can
delete "only" that shape.
I am a novice...and learn by trial and error as well as
searching all the news groups. The "oSection" options I
added came from this posting: 7-2-2001
microsoft.public.word.vab.general Subject:NextHeaderFooter
Any help is greatly appreciated.
Thank you!
Sub DRAFTWaterMark()
Dim i As Integer
Dim oSection As Section, oHeader As HeaderFooter, oShape
As Shape, MyRange As Range
' AddTextEffect fails unless the view is in the header:
ActiveWindow.View.Type = wdPageView
Selection.EndKey Unit:=wdStory
' ActiveWindow.ActivePane.View.SeekView =
wdSeekCurrentPageHeader
ActiveWindow.ActivePane.View.SeekView =
wdSeekFirstPageHeader
For Each oSection In ActiveDocument.Sections
For Each oHeader In oSection.Headers
If oHeader.Exists Then
Set MyRange = oHeader.Range
oHeader.Shapes.AddTextEffect
(msoTextEffect8, "Draft Copy", _
"Times New Roman", 36#, msoFalse,
msoFalse, 226.3, 157.7, MyRange).Select
With oHeader.Range.ShapeRange
If .Count >= 1 Then 'This makes the first
page different than the rest of the pages??
.Fill.Solid
.Fill.ForeColor.RGB = RGB(192, 192, 192)
'Lighter Grey color
'.Fill.ForeColor.RGB = RGB(221, 221, 221)
.Fill.Transparency = 0#
.Line.Weight = 0.75
.Line.DashStyle = msoLineSolid
.Line.Style = msoLineSingle
.Line.Transparency = 0#
.Line.Visible = msoFalse
.LockAspectRatio = msoFalse
.Height = 81.35
.Width = 360#
.Rotation = 0#
.RelativeHorizontalPosition = _
wdRelativeHorizontalPositionPage
.RelativeVerticalPosition = _
wdRelativeVerticalPositionPage
.Left = wdShapeCenter
.Top = wdShapeCenter
.LockAnchor = True
.WrapFormat.AllowOverlap = True
.WrapFormat.Side = wdWrapBoth
.WrapFormat.DistanceTop = InchesToPoints(0)
.WrapFormat.DistanceBottom = InchesToPoints
(0)
.WrapFormat.DistanceLeft = InchesToPoints
(0.13)
.WrapFormat.DistanceRight = InchesToPoints
(0.13)
.WrapFormat.Type = 3
.ZOrder 5
.Shadow.Visible = msoFalse
End If
End With
End If
Next oHeader
Next oSection
ActiveWindow.ActivePane.View.SeekView =_
wdSeekMainDocument
End Sub
'--------------
Sub DeleteDraftWatermark()
'I would like it to delete only the shapes inserted
above...but no such luck.
For Each Section In ActiveDocument.Sections
For Each header In Section.Headers
For Each Shape In header.Shapes
Shape.Delete
Next
Next
Next
End Sub