NoSpaceBetweenParagraphsOfSameStyle

T

Tony Logan

Is there a way I can write the below code without refering ActiveDocument?

ActiveDocument.Styles("Normal").NoSpaceBetweenParagraphsOfSameStyle = True

I'm out of practice with VBA, and am running it inside a VB script that
creates some Word templates. However, this line causes the script to bomb.

The following code works just fine:

Dim objSelection
Set objSelection = Word.Selection
objSelection.Font.Name = "Arial"
objSelection.Font.Size = "14"

My goal is somehow to make NoSpaceBetweenParagraphsOfSameStyle = True.

Thanks.
 
G

Graham Mayor

How about

objSelection.Style.NoSpaceBetweenParagraphsOfSameStyle = True

but it will only work if all the selection is formatted in the same style so
applying a common style first should work eg

With objSelection
.Style = "Normal"
.Style.NoSpaceBetweenParagraphsOfSameStyle = True
.Font.name = "Arial"
.Font.Size = "14"
End With


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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