Hi,
The code below checks the styles in a word document against the styles
in a template that is to be applied - then it will get rid of all
styles in my document that are not in the template - it also deletes
variation of styles that were inadvertently created in my docuemtn
(i.e "style_name Char"). Up to here all is fine, however, the
challenge starts when for some unknown reasons invalid styles in the
form of a space and Char (" CHAR") creeps into my document. The code
below is not able to catch this specific invalid style. Can someone
tell me how to modify this code in order to catch the mentioned
invalid style. thank you.
'delete the style if its not from the template
Dim s() As String
app.Events.Write(WordStyle.NameLocal)
s = WordStyle.NameLocal.Split(" ")
If UCase(s(s.Length - 1)) = "CHAR" Then
WordStyle.Delete()
ElseIf Not ok Then
WordStyle.Delete()
End If