How do I modify a paragraph style in VBA?

  • Thread starter Thread starter HHM
  • Start date Start date
H

HHM

I'm writing a VBA macro.
In the macro, I've added a new style.
Now I'd like to add formatting information to this style. How do I do this
in VBA?
 
HHM said:
I'm writing a VBA macro.
In the macro, I've added a new style.
Now I'd like to add formatting information to this style. How do I do
this in VBA?

Here's some sample code:

Sub demo()
Dim myStyle As Style

Set myStyle = ActiveDocument.Styles.Add( _
Name:="NewStyle", Type:=wdStyleTypeParagraph)

With myStyle
.ParagraphFormat.SpaceAfter = 6
.ParagraphFormat.Alignment = wdAlignParagraphJustify
.NextParagraphStyle = ActiveDocument.Styles("Normal")
.Font.Name = "Arial"
.Font.Bold = True
.Font.Size = 14
End With
End Sub

If you need more help, it would be appropriate to ask in the vba.beginners
group
(http://www.microsoft.com/communitie...t.aspx?dg=microsoft.public.word.vba.beginners).

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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

Back
Top