From: Tony Logan on 25 Sep 2009 15:11 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.
From: Graham Mayor on 26 Sep 2009 10:18 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 <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Tony Logan wrote: > 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.
From: wowens on 1 Oct 2009 13:08 -- wowens "Tony Logan" wrote: > 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.
|
Pages: 1 Prev: Windows7 and Word2007 vba code problem Next: Bulleted lists conversion problems. Help! |