Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 10-03-2013, 02:56 PM
macropod's Avatar
macropod macropod is offline Adding a border to every nth row of a word table Windows 7 32bit Adding a border to every nth row of a word table Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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

Try:
Code:
Sub ModifyActiveTable()
Dim i As Long
With Selection
  If .Information(wdWithInTable) = False Then Exit Sub
  With .Tables(1)
    'Kill any existing borders
    .Borders(wdBorderTop).LineStyle = wdLineStyleNone
    .Borders(wdBorderLeft).LineStyle = wdLineStyleNone
    .Borders(wdBorderBottom).LineStyle = wdLineStyleNone
    .Borders(wdBorderRight).LineStyle = wdLineStyleNone
    .Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
    .Borders(wdBorderVertical).LineStyle = wdLineStyleNone
    For i = 1 To .Rows.Count
      'Restore borders to every 2nd row
      If i Mod 2 = 0 Then
        With .Rows(i).Cells
          .Borders(wdBorderTop).LineStyle = wdLineStyleSingle
          .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
          .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle
          .Borders(wdBorderRight).LineStyle = wdLineStyleSingle
          .Borders(wdBorderHorizontal).LineStyle = wdLineStyleSingle
          .Borders(wdBorderVertical).LineStyle = wdLineStyleSingle
        End With
      End If
    Next
  End With
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a border to every nth row of a word table Aligning Page Border with Table border without losing formatting :mad: l39linden Word Tables 5 10-04-2013 02:06 AM
Adding a border to every nth row of a word table Excel vba adding field in word table/shape in a header Hdr Excel 1 02-04-2013 04:40 PM
"First column" in word table page break border mj1856 Word Tables 1 04-25-2012 03:21 AM
Adding a border to every nth row of a word table adding rows to word table hklein Word VBA 4 07-18-2011 12:21 AM
Adding a border to every nth row of a word table Table Border The Ink Monitor Word Tables 4 03-03-2011 09:17 AM

Other Forums: Access Forums

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