View Single Post
Old 05-17-2015, 03:39 AM   #8
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,794
Karma: 30237628
Join Date: Mar 2012
Location: Sydney Australia
Device: none
I've noticed that in my conversions to DOCX, from poor quality input, I get a boatload of styles. After tidying up the documents, all styles are still there. Here's a macro to delete unused styles from a document, use it after you've done your editing.

Code:
Sub DeleteUnusedStyles()
    Dim oStyle As Style
    For Each oStyle In ActiveDocument.Styles
        'Only check out non-built-in styles
        If oStyle.BuiltIn = False Then
            With ActiveDocument.Content.Find
                .ClearFormatting
                .Style = oStyle.NameLocal
                .Execute FindText:="", Format:=True
                If .Found = False Then oStyle.Delete
            End With
        End If
    Next oStyle
End Sub
Whoops - and thanks for the new feature Kovid - appears to have been a non-trivial piece of work

BR

Last edited by BetterRed; 05-17-2015 at 03:42 AM. Reason: Add - Whoops
BetterRed is online now   Reply With Quote