For example:
Code:
Sub StyleCleaner()
Dim wdDocA As Document, wdDocB As Document, Stl As Style, StrStl As String
Set wdDocA = ActiveDocument: StrStl = "|"
With wdDocA
Set wdDocB = Documents.Open(FileName:=.AttachedTemplate.FullName, AddToRecentFiles:=False, Visible:=False)
With wdDocB
For Each Stl In .Styles
If Stl.BuiltIn = False Then StrStl = StrStl & Stl.NameLocal & "|"
Next
.Close False
End With
For Each Stl In .Styles
With Stl
If .BuiltIn = False Then
If .InUse = False Then
If InStr(StrStl, "|" & .NameLocal & "|") = 0 Then .Delete
End If
End If
End With
Next
End With
MsgBox "All Done.", vbOKOnly
End Sub