![]() |
#6
|
||||
|
||||
![]()
If you use code like:
Code:
Sub AddRandomBorder() Application.ScreenUpdating = False Dim Rng As Range, i As Long, Shp As Shape, iWidth As Long, iHeight As Long With ActiveDocument With .Sections(1).PageSetup iWidth = Int(.PageWidth - 40) iHeight = Int(.PageHeight - 40) End With For i = 1 To .ComputeStatistics(wdStatisticPages) Set Rng = .GoTo(What:=wdGoToPage, Name:=i) Set Shp = .Shapes.AddShape(Type:=1, Top:=0, Left:=0, Width:=iWidth, _ Height:=iHeight, Anchor:=Rng.GoTo(What:=wdGoToBookmark, Name:="\page")) With Shp .RelativeHorizontalPosition = wdRelativeHorizontalPositionPage .RelativeVerticalPosition = wdRelativeVerticalPositionPage .Top = 20 .Left = 20 .Line.ForeColor = RGB(Rnd() * 255, Rnd() * 255, Rnd() * 255) .Line.Weight = 3 .Fill.Transparency = 1 End With Next End With Application.ScreenUpdating = True End Sub Code:
Sub DelRandomBorders() Application.ScreenUpdating = False Dim i As Long, iWidth As Long, iHeight As Long With ActiveDocument With .Sections(1).PageSetup iWidth = Int(.PageWidth - 40) iHeight = Int(.PageHeight - 40) End With For i = .Shapes.Count To 1 Step -1 With .Shapes(i) If .Height = iHeight Then If .Width = iWidth Then .Delete End If End With Next End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
l39linden | Word Tables | 5 | 10-04-2013 02:06 AM |
![]() |
ketanco | Project | 1 | 03-30-2013 08:24 AM |
![]() |
choy | Word | 3 | 08-01-2012 09:12 PM |
random pop up wont go away | 464646 | OneNote | 0 | 05-01-2012 04:34 AM |
Only Random Border Lines Printing! | TheCatSpeaks | Excel | 4 | 05-17-2010 07:39 AM |