sorcerer was telling us:
sorcerer nous racontait que :
Hi Charles..
I couldn't see any worth while macros in that Syles..website
http://addbalance.com/word
I know to do the stuff using word. But I was told to do the same
explicitly using
programs. i.e macros.. Can you help. This is what happens in Word..
The Source Document has some text in Heading 1 Format as shown in the
formatting box on Top Left Toolbar. I find it and then change it to my
style Arial 18 Bold.
Then what happens in the formatting box is that it shows Heading
1+Arial..
I want it to show only Heading 1. Is that possible using word macros.
If you apply some formatting changes to a paragraph, the style has not
changed at all. The local paragraph is formatted differently from its style.
The name change you see is because in Tools > Options > Edit tab > Keep
Track of Formatting is checked.
Uncheck it and the style name will not change in the style drop down.
Still, you have not changed the style definition if you only have applied
local changes to a paragraph. In code, to change a style definition (and
therefore automatically apply this change to all paragraph that are
formatted with this style, try this:
'______________________________________
Sub ChangeStyle()
Const myStyleName As String = "Heading 1"
Dim myStyle As Style
Set myStyle = ActiveDocument.Styles(myStyleName)
With myStyle
With .Font
.Name = "Times New Roman"
.Bold = False
.Size = 32
End With
.ParagraphFormat.Alignment = wdAlignParagraphCenter
End With
End Sub
'______________________________________
Just change the name of the style in the first line of the code and use the
..Font/.ParagraphFormat properties you need.
--
Salut!
______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site:
http://www.word.mvps.org