Applying styles and font change

L

lwert

Why doesn't the font size always change when applying a style?

I select a section of text in a MS Word document (2003 or 2007) and apply
the desired style to it, most of the formatting is applied, but the font
and/or font size doesn't always change. This happens with some default
styles, such as "plain text" and with custom styles that I have created.

Does anyone know why this is or what I can do differently to ensure the font
changes when I change the style?

Thanks...
 
S

Suzanne S. Barnhill

Applying a style applies paragraph formatting invariably. It applies font
formatting based on an algorithm that looks at the current text formatting.
If 50% or more of the text has font formatting applied as direct formatting,
this is overwritten with the Default Paragraph Font of the applied style. If
the direct font formatting is applied to less than 50% of the text, Word
leaves it intact. This preserves special cases such as italics for book
titles and the like.
 
L

lwert

Thanks for the post.

Then is there a way to defeat this behavior in certain circumstances?

I am actually processing a text document from another system using VBA and
would like to convert everything to a smaller font size. In MSW2003, I could
just change the font size in the underlying style and everything changed to
the desired font size. This doesn't work the same way in MSW2007. I can
obviously select all of the text and then set the font size using direct
formatting, but this seems to defeat the universal nature of using styles.
--
L. Wert


Suzanne S. Barnhill said:
Applying a style applies paragraph formatting invariably. It applies font
formatting based on an algorithm that looks at the current text formatting.
If 50% or more of the text has font formatting applied as direct formatting,
this is overwritten with the Default Paragraph Font of the applied style. If
the direct font formatting is applied to less than 50% of the text, Word
leaves it intact. This preserves special cases such as italics for book
titles and the like.
 
S

Suzanne S. Barnhill

I don't yet have much experience with Word 2007, and if you're trying to do
this through VBA, you might be better advised to post in one of the word.vba
newsgroups, such as microsoft.public.word.vba.general.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

lwert said:
Thanks for the post.

Then is there a way to defeat this behavior in certain circumstances?

I am actually processing a text document from another system using VBA and
would like to convert everything to a smaller font size. In MSW2003, I
could
just change the font size in the underlying style and everything changed
to
the desired font size. This doesn't work the same way in MSW2007. I can
obviously select all of the text and then set the font size using direct
formatting, but this seems to defeat the universal nature of using styles.
 
K

Klaus Linke

Suzanne S. Barnhill said:
I don't yet have much experience with Word 2007, and if you're
trying to do this through VBA, you might be better advised to post
in one of the word.vba newsgroups, such as
microsoft.public.word.vba.general.

Or to save you the trouble:

' For Word 2007...
' If you use an older version, replace
' ParagraphStyle with Style.
'
Dim myPara As Paragraph
Dim myRange as Range
Set myRange=Selection.Range
myRange.WholeStory

For Each myPara In myRange.Paragraphs
myPara.Range.Font.Size = myPara.ParagraphStyle.Font.Size
Next myPara

If you haven't used macros before, see
http://word.mvps.org/faqs/macrosvba/CreateAMacro.htm

Regards,
Klaus
 
L

lwert

Klaus,
Thanks for the reply. I actually do a fair amount of VBA, albeit not so
much in Word, so the classes are not as familiar. As a result, I didn't know
about the "ParagraphStyle" property. I will look further with that lead.
 

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

Top