trouble with setting paragraph spacing to a table

A

Associates

Hi,

I was trying to set the paragraph spacing before and after to 3 pt to a
table with 3 rows and 3 columns but with no success.

Here is the code
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=myRow,
NumColumns:= _
myCol, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed

With Selection.Tables(1)
If .Style <> "Table Grid" Then
.Style = "Table Grid"
End If
.ApplyStyleHeadingRows = True
.ApplyStyleLastRow = True
.ApplyStyleFirstColumn = True
.ApplyStyleLastColumn = True
.Rows.Alignment = wdAlignRowCenter

With Selection.ParagraphFormat
.LeftIndent = CentimetersToPoints(0)
.RightIndent = CentimetersToPoints(0)
.SpaceBefore = 3
.SpaceBeforeAuto = False
.SpaceAfter = 3
.SpaceAfterAuto = False
.LineSpacingRule = wdLineSpaceSingle
.Alignment = wdAlignParagraphCenter
.WidowControl = True
.KeepWithNext = False
.KeepTogether = False
.PageBreakBefore = False
.NoLineNumber = False
.Hyphenation = True
.FirstLineIndent = CentimetersToPoints(0)
.OutlineLevel = wdOutlineLevelBodyText
.CharacterUnitLeftIndent = 0
.CharacterUnitRightIndent = 0
.CharacterUnitFirstLineIndent = 0
.LineUnitBefore = 0
.LineUnitAfter = 0
End With

What this code does is it only set the spacing to the first cell of the
table instead of applying it to the rest of the table. Not sure if it needs
some kind of loop to set all the cells with the same spacing paragraph.

Your help would be greatly appreciated.

Thank you in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

set hanging indent for second TOC 1
Table Repeating Issue 1
TOC Help 0
TOC Problem 0
A macro to increase line spacing 1
Table of Content 1
TOC problem 0
Converting Visual Basic inside Word Document to VBScript 2

Top