Hi All:
I'm missing something obvious.
I want to create a new style by copying an existing one and making a
few mods, the equivalent to using the "Based On" field in the styles
dialog. After thinking about Set statements and the like, I'm confused
as to how to go about this. Just how does one copy an object?
Garry
Greg Maxey - 29 Nov 2005 01:05 GMT
Something like:
Sub Scratch()
Dim style As Style
Set style = Active.Styles.Add("YourNewStyleName")
With oStyle
.BaseStyle = ActiveDocument.Styles("Normal")
.Font.Bold = True
.ParagraphFormat.LineSpacing = 24
End With
End Sub

Signature
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.
> Hi All:
>
[quoted text clipped - 6 lines]
>
> Garry
Klaus Linke - 29 Nov 2005 01:14 GMT
Hi Garry,
There's no "clean" way in VBA to copy a style, AFAIK. You just use .Add to
create a new one, and set ".BasedOn" to the existing one.
As in the user interface, the newly added style will pick up any manual
(font/paragraph) formatting from the start of the current selection, so
you'd either need to make sure that none is applied, or (re)set all the
formatting to that of the base style.
Regards,
Klaus
> Hi All:
>
[quoted text clipped - 6 lines]
>
> Garry