Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-04-2012, 02:45 AM
macropod's Avatar
macropod macropod is offline Macro to set page borders Windows 7 64bit Macro to set page borders Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,379
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default


Hi Jennifer,

You can't have option 3. That aside, try:
Code:
Sub Borders()
Application.ScreenUpdating = False
Dim i As Long
With Selection.Sections(1)
  If .Borders(wdBorderLeft).LineStyle = wdLineStyleNone Then
    For i = 1 To 4
      With .Borders(i)
      .LineStyle = wdLineStyleSingle
      .LineWidth = wdLineWidth025pt
      .Color = wdColorAutomatic
      End With
    Next
    With .Borders
      .DistanceFrom = wdBorderDistanceFromText
      .DistanceFromTop = 1
      .DistanceFromLeft = 1
      .DistanceFromBottom = 1
      .DistanceFromRight = 1
    End With
  ElseIf .Borders.DistanceFrom = wdBorderDistanceFromText Then
    With .Borders
      .DistanceFrom = wdBorderDistanceFromPageEdge
      .DistanceFromTop = 24
      .DistanceFromLeft = 24
      .DistanceFromBottom = 24
      .DistanceFromRight = 24
    End With
  Else
    .Borders(wdBorderLeft).LineStyle = wdLineStyleNone
    .Borders(wdBorderRight).LineStyle = wdLineStyleNone
    .Borders(wdBorderTop).LineStyle = wdLineStyleNone
    .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
  End If
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to set page borders Page-crossing borders in a table with hidden between-cell borders tenpaiman Word 2 08-08-2012 07:20 PM
Macro to set page borders merging documents in macro page no Rose_Garden Word 1 03-31-2012 04:50 AM
Macro to insert new page... samanthaj Word 17 01-31-2012 01:53 PM
Page borders vs Orientation Ineedcoffee Word 5 12-06-2011 12:52 PM
Macro to set page borders Page number Macro kimsi Word 3 11-15-2011 11:54 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:31 PM.


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