Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Tables / September 2004

Tip: Looking for answers? Try searching our database.

Double Vertical Borders in Tables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rashid Khan - 01 Sep 2004 13:35 GMT
Hello All,
I am using Office XP.  I have a document with many tables of various
columns... i.e. 2 cols, 3 cols, 4 cols, 5 cols......All tables have an
outside single borders and vertical single borders.
I need to have a macro which would draw a double vertical borders between
2nd and 3rd columns on all the tables that are 4 Cols.  Other tables should
be left intact.

Can this be achieved through VBA?

Any help would be suggested.  At present I do it manually.
TIA
Rashid
Jay Freedman - 01 Sep 2004 15:06 GMT
> Hello All,
> I am using Office XP.  I have a document with many tables of various
[quoted text clipped - 9 lines]
> TIA
> Rashid

Hi Rashid,

This should do:

Sub DoubleBorder()
  Dim oTbl As Table

  On Error Resume Next

  For Each oTbl In ActiveDocument.Tables
     If oTbl.Columns.Count = 4 Then
        oTbl.Columns(2).Borders(wdBorderRight) _
           .LineStyle = wdLineStyleDouble
     End If
  Next oTbl
End Sub

It has one limitation: if a 4-column table contains any horizontally merged
cells, the border in that table will not be changed. That's because trying
to do anything with the Columns collection in such a table causes an error
(hence the On Error statement, which causes the macro to ignore the table).
If this is a problem for you, please reply in the newsgroup.

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

Rashid Khan - 01 Sep 2004 19:12 GMT
Hi Jay,
Thanks for your quick response.
It works like a charm. You r a genious.

Rashid
> > Hello All,
> > I am using Office XP.  I have a document with many tables of various
[quoted text clipped - 37 lines]
> Jay Freedman
> Microsoft Word MVP          FAQ: http://word.mvps.org
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.