Add a Paragraph Style in W2007 vba

K

KAM

I am trying to add a paragraph style though vba in Word 2007.

ActiveDocument.Styles.Add Name:="MINE", Type:=wdStyleTypeParagraph
OR
ActiveDocument.Styles.Add ("MINE")

Both ways apply the style as a CHARACTER style.

Can anyone tell me how to add a PARAGRAPH style in vba?
By the way, BOTH the above worked just fine in Word 2003.

AND, I am stuck adding the styles "manually" through code instead of using
..organizercopy since .organizercopy (in vba) does not want to work with a doc
if it is not saved locally!! Ughh!

Any help is greatly appreciated!
 
K

KAM

Nevermind: I have been able to locate that Word 2007 added 2 more types:
Original 4 Styles.add types:
wdStyleTypeCharacter
wdStyleTypeList
wdStyleTypeParagraph
wdStyleTypeTable

New 2 types for Styles.Add:
wdStyleTypeParagraphOnly
wdStyleTypeLinked

Once I changed type:= from wdStyleTypeParagraph to wdStyleTypeParagraphOnly,
it added the style as a PARAGRAPH style. I have no idea why
wdStyleTypeParagraph would not work.

(I still don't like Word2007)

And, when I went to the vba help for styles.add, it did NOT give me the
options available for type:=
 

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