Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 11-30-2011, 04:33 AM
macropod's Avatar
macropod macropod is offline Word VBA: add borders to active table Windows 7 64bit Word VBA: add borders to active 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

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]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
letterhead design with column and borders jiquvox Word 1 10-11-2011 11:18 AM
Word VBA: add borders to active table BORDERS are too big 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
Word VBA: add borders to active table Tables and Borders/Gridlines Jukee Word 1 06-22-2010 02:49 AM
I need to use alternating borders sarajev Word 1 11-19-2009 01:56 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:37 AM.


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