Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 11-20-2013, 12:45 PM
Catty Catty is offline VBA code to align watermarks Windows 7 32bit VBA code to align watermarks Office 2010 32bit
Advanced Beginner
VBA code to align watermarks
 
Join Date: Nov 2013
Posts: 39
Catty is on a distinguished road
Default

Thanks a lot Greg...this works beautifully.

I have two other concerns though. I have created a DeleteWaterMark macro which was working 100% first run, but now
after inserting my "new" watermark, I have to run the DeleteWaterMark macro twice before the watermark is removed.

Also for testing purposes, when I try to insert 2 different watermarks on the same document, the second watermark
"hangs" on the top half of the header instead of just replacing the first one (hope I'm making sense).
How can I resolve this? Below is the DeleteWaterMark macro. Thanks so much for your help!
Code:
Sub DeleteWatermark() 
  Dim oSection As section 
  Dim oHeader As HeaderFooter 
  Dim oRng As Range 
  Dim oShape As Shape 
  On Error Goto Errhandler 
  For Each oSection In ActiveDocument.Sections 
    For Each oHeader In oSection.Headers 
      If oHeader.Exists Then 
        Set oRng = oHeader.Range 
        oRng.End = oRng.Paragraphs(1).Range.End - 1 
        For Each oShape In oRng.ShapeRange 
          If oShape.Type = 15 Then oShape.Delete 
        Next oShape 
      End If 
    Next oHeader 
  Next oSection 
   
Errhandler: 
  MsgBox "Watermark successfully removed." 
End Sub

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to align texts so they all end at the same line patehi Word 3 05-25-2013 11:47 PM
VBA code to align watermarks Resize and align AndyDDUK PowerPoint 9 11-09-2012 05:23 AM
VBA code to align watermarks 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
Question on watermarks kknutson Word 0 04-26-2007 04:12 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:56 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