![]() |
#1
|
|||
|
|||
![]() Code:
Sub table() With ActiveDocument .Tables.Add Range:=Selection.Range, _ NumRows:=3, _ NumColumns:=3, _ DefaultTableBehavior:=wdWord8TableBehavior ' I want to select this table ' and add borders End With With ActiveDocument.Tables(2) .Borders(wdBorderTop).LineStyle = wdLineStyleSingle .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle .Borders(wdBorderRight).LineStyle = wdLineStyleSingle .Borders(wdBorderHorizontal).LineStyle = wdLineStyleSingle .Borders(wdBorderVertical).LineStyle = wdLineStyleSingle .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleSingle .Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleSingle End With End Sub Please help, thx! |
#2
|
||||
|
||||
![]()
Hi Tinfanide,
This is easiest if you assign the new table to a variable: Code:
Sub AddTable() Dim oTbl With ActiveDocument Set oTbl = .Tables.Add(Range:=Selection.Range, NumRows:=3, _ NumColumns:=3, DefaultTableBehavior:=wdWord8TableBehavior) With oTbl .Borders(wdBorderTop).LineStyle = wdLineStyleSingle .Borders(wdBorderLeft).LineStyle = wdLineStyleSingle .Borders(wdBorderBottom).LineStyle = wdLineStyleSingle .Borders(wdBorderRight).LineStyle = wdLineStyleSingle .Borders(wdBorderHorizontal).LineStyle = wdLineStyleSingle .Borders(wdBorderVertical).LineStyle = wdLineStyleSingle .Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleSingle .Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleSingle End With End With Set oTbl = Nothing End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Yes, just like giving the table an id.
|
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
letterhead design with column and borders | jiquvox | Word | 1 | 10-11-2011 11:18 AM |
![]() |
rockerz | Word | 3 | 06-08-2011 06:17 PM |
Drag Button which refers to the active Word document to Explorer | DRob | Word | 0 | 10-03-2010 06:40 AM |
![]() |
Jukee | Word | 1 | 06-22-2010 02:49 AM |
I need to use alternating borders | sarajev | Word | 1 | 11-19-2009 01:56 AM |