Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-24-2018, 06:46 AM
shu shu is offline Inserting watermarks in a doc with several sections Windows 10 Inserting watermarks in a doc with several sections Office 2016
Novice
Inserting watermarks in a doc with several sections
 
Join Date: Jun 2018
Posts: 6
shu is on a distinguished road
Default Inserting watermarks in a doc with several sections

Helloo,

I tried to insert watermarks in the middle of every page in a document with several sections and it worked (Code is below). But when there's a table in the header then the watermark gets not placed in the middle of the page but elsewhere. Does anyone know why?

Thx and BR,
shu

Code:
Dim wassZ1 As Shape
Dim i As Long

For i = 1 To ActiveDocument.Sections.Count
    
    With ActiveDocument.Sections(i).Headers(wdHeaderFooterPrimary).Range
            'Überprüfen ob schon ein WZ vorhanden ist, wenn ja dann löschen
            If .ShapeRange.Count > 0 Then
                .ShapeRange(1).Delete
            End If
     End With
        
        'neues Wasserzeichen einfügen
       With ActiveDocument.Sections(i)
             Set wassZ1 = .Headers(wdHeaderFooterPrimary).Shapes.AddTextEffect(PresetTextEffect:=msoTextEffect2, _
             Text:="DRAFT1", FontName:="Arial", FontSize:=36, FontBold:=msoTrue, FontItalic:=msoFalse, _
             Left:=1, Top:=1)
       End With
    

    With wassZ1
    .Fill.Visible = msoTrue
    .Fill.Solid
    .Fill.ForeColor.RGB = RGB(192, 192, 192)
    .Fill.Transparency = 0.5
    .Line.Weight = 0.75
    .Line.DashStyle = msoLineSolid
    .Line.Style = msoLineSingle
    .Line.Transparency = 0
    .Line.Visible = msoFalse
    .LockAspectRatio = msoFalse
    .Rotation = 330
    .Height = CentimetersToPoints(8)
    .Width = CentimetersToPoints(15)
    .RelativeHorizontalPosition = _
        wdRelativeHorizontalPositionMargin
    .RelativeVerticalPosition = _
        wdRelativeVerticalPositionMargin
    .RelativeHorizontalSize = wdRelativeHorizontalSizePage
    .RelativeVerticalSize = wdRelativeVerticalSizePage
    .Left = wdShapeCenter
    .LeftRelative = wdShapePositionRelativeNone
    .Top = wdShapeCenter
    .TopRelative = wdShapePositionRelativeNone
    .WidthRelative = wdShapeSizeReativeNone
    .HeightRelative = wdShapeSizeRelativeNone
    'Vali docs
    '.IncrementLeft 120
    '.IncrementTop 280
   End With
           
    Next I


Last edited by macropod; 09-24-2018 at 05:07 PM. Reason: Added code tags
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Inserting watermarks in a doc with several sections Watermarks PomDave Word 1 08-04-2018 05:45 PM
Inserting watermarks in a doc with several sections Watermarks gamiezio Word 5 08-18-2017 09:23 AM
Inserting section between existing sections GoneBirding Word 0 10-18-2012 03:01 PM
Inserting watermarks in a doc with several sections Clipart and Watermarks Maureen Office 3 09-30-2011 02:53 AM
Watermarks on the web David S Word 0 07-28-2011 07:54 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:22 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft