Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
HHM HHM is offline
external usenet poster
 
Posts: 3
Default How do I modify a paragraph style in VBA?

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?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default How do I modify a paragraph style in VBA?

HHM wrote:
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/communities...a.beginner s).

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how do you modify a custom style set? Style Short cut keys don't w Bob Day[_2_] Microsoft Word Help 2 September 1st 07 08:20 PM
Modify Footnote Style CJ Page Layout 2 June 15th 07 02:00 PM
Modify table of contents to include headings from a paragraph Joseph McCurley Microsoft Word Help 3 May 16th 06 02:41 PM
Modify paragraph but all with same style is modified (not wanted) Pamela Microsoft Word Help 1 March 28th 06 05:12 AM
Modify style with picture jacobk Page Layout 1 April 21st 05 10:54 PM


All times are GMT +1. The time now is 03:26 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"