I have a macro that called a certain paragraph style and then applied overrides to that style in subsequent steps of macro. I created character styles to represent the overrides. Here is the before and after of the relevant piece of code: BEFORE: Selection.HomeKey Unit:=wdLine Selection.Style = ActiveDocument.Styles("Caution+Warning") With Selection.Font .Bold = True .Size = 16 .ColorIndex = wdRed End With Selection.TypeText Text:="!" With Selection.Font .Bold = True .Size = 11 .ColorIndex = wdRed End With Selection.TypeText Text:=vbTab & "WARNING:" 'Format text of warning With Selection.Font .Bold = False .Size = 11 .ColorIndex = wdAuto End With Selection.TypeText Text:=" " AFTER: Selection.HomeKey Unit:=wdLine Selection.Style = ActiveDocument.Styles("Caution+Warning") Selection.Style = ActiveDocument.Styles("CR Font 16 Red") Selection.TypeText Text:="!" Selection.Style = ActiveDocument.Styles("CR Red Bold") Selection.TypeText Text:=vbTab & "WARNING:" Selection.Style = ActiveDocument.Styles("Caution+Warning") Selection.TypeText Text:=" " Essentially, my intent is to have a warning style for a note where the lead-in to the note has character formatting applied but the text of the warning actually reverts to the base "Warning" paragraph style. This does not work. The text remains red and bold. I can't even toggle the bold off . Does anyone have any ideas on this or can anyone refer me to another source for information? I can only guess that Word may require that I select the character that I want to apply the character style to rather than toggling it on when I want to use it. Toggling it on appears to work but apparently selecting another style does not remove the character format. -------------------------------------------------------------------------------- David
To use VBA to clear all manually applied character formatting (including character styles) from a selection or range, use the Font.Reset method of the selection or range. -- Regards Jonathan West - Word MVP www.intelligentdocuments.co.uk Please reply to the newsgroup "david" wrote in message news:4DD5B102-4174-4D77-BEA7-5627D37C5540@microsoft.com... >I have a macro that called a certain paragraph style and then applied > overrides to that style in subsequent steps of macro. I created character > styles to represent the overrides. Here is the before and after of the > relevant piece of code: > > > > BEFORE: > > Selection.HomeKey Unit:=wdLine > Selection.Style = ActiveDocument.Styles("Caution+Warning") > With Selection.Font > .Bold = True > .Size = 16 > .ColorIndex = wdRed > End With > Selection.TypeText Text:="!" > With Selection.Font > .Bold = True > .Size = 11 > .ColorIndex = wdRed > End With > Selection.TypeText Text:=vbTab & "WARNING:" > > 'Format text of warning > With Selection.Font > .Bold = False > .Size = 11 > .ColorIndex = wdAuto > End With > Selection.TypeText Text:=" " > > > > AFTER: > > Selection.HomeKey Unit:=wdLine > Selection.Style = ActiveDocument.Styles("Caution+Warning") > Selection.Style = ActiveDocument.Styles("CR Font 16 Red") > Selection.TypeText Text:="!" > > Selection.Style = ActiveDocument.Styles("CR Red Bold") > Selection.TypeText Text:=vbTab & "WARNING:" > > Selection.Style = ActiveDocument.Styles("Caution+Warning") > Selection.TypeText Text:=" " > > > > Essentially, my intent is to have a warning style for a note where the > lead-in to the note has character formatting applied but the text of the > warning actually reverts to the base "Warning" paragraph style. This does > not > work. The text remains red and bold. I can't even toggle the bold off . > > > > Does anyone have any ideas on this or can anyone refer me to another > source > for information? I can only guess that Word may require that I select the > character that I want to apply the character style to rather than toggling > it > on when I want to use it. Toggling it on appears to work but apparently > selecting another style does not remove the character format. > > > > > -------------------------------------------------------------------------------- > David > >
Jonathan: is there a way to find paragraphs that have manual formatting applied? I don't want to change them, just to find them. Could I apply the font.reset method and compare the paragraph after with the (cached) paragraph before? Or is there something easier? - Jessica