K
KAM
I am trying to add styles to a document through vba code. (I am only doing it
this way since .Organizercopy in vba requires the destination doc to be saved
local first...which I still don't have a work around.)
In vba, I have created "_Journal font" style to be my "base" style. All
attributes are defined explicitly in code.
Then I add another style (in vba):
Application.ActiveDocument.Styles.Add Name:="_Document", _
Type:=wdStyleTypeParagraphOnly
With ActiveDocument.Styles("_Document")
.AutomaticallyUpdate = False
.BaseStyle = "_Journal font"
.NextParagraphStyle = "_Document"
End With
With ActiveDocument.Styles("_Document").ParagraphFormat
.SpaceAfter = 10
.LineSpacingRule = wdLineSpaceSingle
.FirstLineIndent = InchesToPoints(0.25)
End With
And I have only coded for those attributes that are different from the base
style "_Journal font".
Stepping through the code, I have to add it first (which adds the new style
_Document and bases it on Normal. Then when it runs the code to base it on
"_Journal font" it SAYS it is based on "_Journal font" but it still is
retaining the formatting from Normal.
It seems like useless code to add ALL of the attributes for each and every
style that I am adding - especially since they are based on another style and
may just have one small change.
Oh please HELP!
Thanks!
this way since .Organizercopy in vba requires the destination doc to be saved
local first...which I still don't have a work around.)
In vba, I have created "_Journal font" style to be my "base" style. All
attributes are defined explicitly in code.
Then I add another style (in vba):
Application.ActiveDocument.Styles.Add Name:="_Document", _
Type:=wdStyleTypeParagraphOnly
With ActiveDocument.Styles("_Document")
.AutomaticallyUpdate = False
.BaseStyle = "_Journal font"
.NextParagraphStyle = "_Document"
End With
With ActiveDocument.Styles("_Document").ParagraphFormat
.SpaceAfter = 10
.LineSpacingRule = wdLineSpaceSingle
.FirstLineIndent = InchesToPoints(0.25)
End With
And I have only coded for those attributes that are different from the base
style "_Journal font".
Stepping through the code, I have to add it first (which adds the new style
_Document and bases it on Normal. Then when it runs the code to base it on
"_Journal font" it SAYS it is based on "_Journal font" but it still is
retaining the formatting from Normal.
It seems like useless code to add ALL of the attributes for each and every
style that I am adding - especially since they are based on another style and
may just have one small change.
Oh please HELP!
Thanks!