Discussion:
NoSpaceBetweenParagraphsOfSameStyle
(too old to reply)
Tony Logan
2009-09-25 19:11:01 UTC
Permalink
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.
Graham Mayor
2009-09-26 14:18:20 UTC
Permalink
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

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Post by 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.
Dim objSelection
Set objSelection = Word.Selection
objSelection.Font.Name = "Arial"
objSelection.Font.Size = "14"
My goal is somehow to make NoSpaceBetweenParagraphsOfSameStyle = True.
Thanks.
wowens
2009-10-01 17:08:01 UTC
Permalink
--
wowens
Post by 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.
Dim objSelection
Set objSelection = Word.Selection
objSelection.Font.Name = "Arial"
objSelection.Font.Size = "14"
My goal is somehow to make NoSpaceBetweenParagraphsOfSameStyle = True.
Thanks.
Loading...