Before and After Spacing.

A

Andrew .

Hi All,

I have a program that merges a text file with my own delimiters into a
blank word document.

I create a table an insert a number of rows.

Recently I have notice the paragraph spacing in the cells is now set
to 0pt before and 10pt after.

Can someone help me set the after spacing to 0pt, either per cell or
for the table as a whole or even for the entire document. I have
tried a number of commands but I can't seem to get it.

Regards,
Andrew.
 
P

Pesach Shelnitz

Hi Andrew,

Although the more efficient way to control the paragraph spacing is to
define a paragraph style with the desiried spacing and apply it to your
paragraphs, you can use the following macro to set the space after the
paragraphs in all your tables to 0.

Sub SetSpaceAfterToZero()
Dim i As Long

With ActiveDocument
For i = 1 To .Tables.Count
.Tables(i).Range.ParagraphFormat.SpaceAfter = 0
Next
End With
End Sub
 
A

Andrew .

Hi Andrew,

Although the more efficient way to control the paragraph spacing is to
define a paragraph style with the desiried spacing and apply it to your
paragraphs, you can use the following macro to set the space after the
paragraphs in all your tables to 0.

Sub SetSpaceAfterToZero()
    Dim i As Long

    With ActiveDocument
        For i = 1 To .Tables.Count
            .Tables(i).Range.ParagraphFormat.SpaceAfter = 0
        Next
    End With
End Sub

Thanks Pesach. Worked well.

I also discovered the first paragraph needed a little help too and the
following worked.
ActiveDocument.Paragraphs(1).Range.ParagraphFormat.SpaceAfter = 0

I like your website - great links to other reference sites.

Thanks again.
Andrew.
 

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

Top