fionabolt
02-16-2010, 04:10 AM
In Word 2003, does anyone know a way to intercept the Word Command "Clear Formatting" when triggered from the "Styles and Formatting" task pane?
I have written the following code
Sub ClearFormatting()
'
' ClearFormatting Macro
'
MsgBox "Here in ClearFormatting"
Selection.ClearFormatting
Selection.Style = ActiveDocument.Styles("SOME STYLE OTHER THAN NORMAL")
End Sub
This works, but only when "ClearFormatting" is triggered from the "Style" box on the "Formatting" toolbar. However, when you select "Clear Formatting" from the task pane, the VBA code does not intercept it, and the Word default behaviour occurs, i.e. the style "Normal" is applied.
Has anyone found a solution to this anomaly.
Thanks
Fiona
I have written the following code
Sub ClearFormatting()
'
' ClearFormatting Macro
'
MsgBox "Here in ClearFormatting"
Selection.ClearFormatting
Selection.Style = ActiveDocument.Styles("SOME STYLE OTHER THAN NORMAL")
End Sub
This works, but only when "ClearFormatting" is triggered from the "Style" box on the "Formatting" toolbar. However, when you select "Clear Formatting" from the task pane, the VBA code does not intercept it, and the Word default behaviour occurs, i.e. the style "Normal" is applied.
Has anyone found a solution to this anomaly.
Thanks
Fiona