Clear unused syles in MS Word with VBA

  • Open VBA by press <Alt+F11>
  • Copy the code:
Sub DeleteUnusedStyles()
Dim aStyle As Style
For Each aStyle In ActiveDocument.Styles
If aStyle.BuiltIn = False Then
With ActiveDocument.Content.Find
.ClearFormatting
.Style = aStyle.NameLocal
.Execute FindText:="", Format:=True
If .Found = False Then aStyle.Delete
End With
End If
Next aStyle
End Sub

  • Paste and run...

0 nhận xét:

Đăng nhận xét

 
Đầu trang