>[Word 2003]: I am trying to figure out a way to programatically apply the
>".font.reset" method to all text of particular document style. Ideally I
[quoted text clipped - 15 lines]
>
>Thanks.
This should show the way...
Sub ResetStyles()
Dim StyleList As Variant
Dim i As Long
Dim oRg As Range
StyleList = Split("Normal,Heading 1,Heading 2", ",")
For i = 0 To UBound(StyleList)
Set oRg = ActiveDocument.Range
With oRg.Find
.ClearFormatting
.Text = ""
.Style = ActiveDocument.Styles(StyleList(i))
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = False
Do While .Execute
oRg.Font.Reset
Loop
End With
Next
End Sub
Within the first pair of quotes in the Split function, enter a
comma-delimited list of all the style names that you want to reset.
The For loop will cycle through the listed styles, and the Do loop
will reset all occurrences of each style in the main body of the
document.
If you also need to reset styles in textboxes, headers/footers,
footnotes/endnotes, etc. then you need more stuff in your macro.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
automandc - 11 Apr 2007 03:44 GMT
Perfect, thanks!
> >[Word 2003]: I am trying to figure out a way to programatically apply the
> >".font.reset" method to all text of particular document style. Ideally I
[quoted text clipped - 61 lines]
> Email cannot be acknowledged; please post all follow-ups to the
> newsgroup so all may benefit.
Klaus Linke - 11 Apr 2007 04:57 GMT
... and you wouldn't really need a macro: Replacing with the "Default
Paragraph Font" achieves exactly the same result.
Regards,
Klaus
> Perfect, thanks!
>
[quoted text clipped - 74 lines]
>> Email cannot be acknowledged; please post all follow-ups to the
>> newsgroup so all may benefit.