All,
The problem of unwanted “char char” styles propagating in Word 2002 documents (due to applying a paragraph style to a partially-selected paragraph) has been discussed here before, but based on a quick search, I didn’t see a good fix posted (apologies if one was, and I’ve just missed it).
(The presence of these unwanted ‘char’ styles can be detected either by looking at the Styles tab in the Organizer, or by holding down the Shift key before looking in the Styles dropdown in the Formatting toolbar.)
Andrew Lockton posted a related macro here, but that only gets to the char char style issue as a side effect (if I’m reading it right).
Anyway, the following seems to work – this is expanded upon a macro posted (somewhere, cannot find source) by Cindy Meister, for deleting a single char char style. From there, it’s a small step to expand it out to delete all of the char char styles in a document:
Public Sub RemoveAllCharCharStyles() Dim objDocStyles As Styles Dim objTempStyle As Style Dim StylesCt As Long Dim strStyleName As String Dim n As Long Set objDocStyles = ActiveDocument.Styles StylesCt = objDocStyles.Count For n = StylesCt To 1 Step -1 strStyleName = objDocStyles(n).NameLocal If fStyleNameEndsInChar(strStyleName) Then Set objTempStyle = objDocStyles.Add(Name:="zTempStyle") On Error Resume Next objDocStyles(strStyleName).LinkStyle = objTempStyle objTempStyle.Delete Set objTempStyle = Nothing End If Next 'n Set objDocStyles = Nothing End Sub Private Function fStyleNameEndsInChar(StyleName As String) As Boolean If LCase$(Right$(StyleName, 4)) = "char" Then fStyleNameEndsInChar = True End Function
Gary
PS: Hi to my Lounge friends; I miss this place, keeping hoping I’ll be able work a bit less and play here more!