Thank you for your "detective work" in this area!
Note that there is a setting in the Styles pane to prevent the use of linked
styles. I'm wondering if that could be relevant for your discoveries?
Stefan Blom
Microsoft Word MVP
"dedawson" wrote in message
After poking around a bit more, I have concluded that MS has either
accidentally, or intentionally, removed the ability to delink
paragraph and character styles in Word 2007.
Here’s how I have come to this conclusion.
I have always built my templates programmatically (since Word 97,
based upon techniques presented by various Word MVPs) in order to
avoid the spaghetti numbering issues that have been with Word for so
long. Part of that code included the statements to define new styles,
including their type.
e.g., ActiveDocument.Styles.Add Name:="P0", Type:=wdStyleTypeParagraph
Executing this code in 2003 would result in the creation of a style
that was indeed a pure paragraph style. When viewed in the Styles
task pane, style P0 would show only the ¶, and when viewed in the
Modify Style dialog the Style Type is given as Paragraph and is the
dropdown is enabled for modification. If an associated Character
style, P0 Char, were to be subsequently generated by the application
of direct character formatting to a subset of the characters within a
P0 paragraph, one could programmatically unlink the two styles (using
code provided at
http://oreilly.com/pub/h/2597 ) (it worked well; I
used it often)
Executing this code in 2007, however, provides different results.
When viewed in the Styles task pane dialog style P0 is shown as ¶a,
and when viewed in the Modify Style dialog the Style Type is given as
Linked (paragraph and character) and is grayed out. The O’Reilly
code will not, however, unlink these two styles.
Further investigation reveals Word 2007 has an additional enumeration
for WdStyleType, that being wdStyleTypeParagraphOnly
Execution of ActiveDocument.Styles.Add Name:="P0",
Type:=wdStyleTypeParagraphOnly will result in the definition of a
style that was indeed a pure paragraph style. When viewed in the
Styles task pane dialog, style P0 would show only the ¶, and when
viewed in the Modify Style dialog the Style Type is given as Paragraph
and is enabled for modification.
Here’s where it gets nasty, however. If one uses the 2007 Modify
Paragraph dialog to change the type of the P0 style from Paragraph to
Linked (paragraph and character), there is no turning back. The P0
Char style gets created, and the Style Type dropdown in the Modify
Styles dialog gets disabled.
Decided to go a little further, and recorded a macro while I used the
Modify Style dialog to modify the Style Type from Paragraph to Linked
(paragraph and character). Examination of the code that is generated
reveals that whatever is being done to effect the change does not get
recorded as code. Lovely.
But remember, using Type:=wdStyleTypeParagraphOnly does allow one to
create a pure Paragraph style. Now all one needs to do is prevent it
from being converted to a Linked paragraph style. Guess what?
The .locked attribute that one would expect to preclude changes
apparently has no effect. About the only means of preventing creation
of a pair of Linked paragraph and character styles is to enable
Disable Linked Styles in the Styles task pane. But, since there does
not appear to be any means of locking this into place, a user could
disable it, and the end up creating Linked styles.
In summary, it would appear that the ability to create bullet-proof
templates with auto-numbered styles has been broken. If anyone has
any further light to shed on this, I’m sure it would be welcomed by
many.