Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Feb 2003
    Location
    Annapolis, Maryland, USA
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    list of styles (2002)

    Is there a way to generate a list of styles used in a document, other than printing the styles, so that I can edit the list, or paste it into an e-mail?
    Michael Coleman
    BOMI International

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: list of styles (2002)

    This macro will create a list of all Paragraph Styles in use in the active document. The list will be appended to the end of the document. If you need character styles as well then that will need a bit more work.

    StuartR

    Dim paraTemp As Paragraph
    Dim strStylesInDoc() As String
    Dim i As Integer
    Dim blnStyleFound As Boolean

    ReDim strStylesInDoc(0)
    For Each paraTemp In ActiveDocument.Paragraphs
    blnStyleFound = False
    For i = 0 To UBound(strStylesInDoc)
    If strStylesInDoc(i) = paraTemp.Style.NameLocal Then
    blnStyleFound = True
    Exit For
    End If
    Next i
    If Not blnStyleFound Then
    ReDim Preserve strStylesInDoc(UBound(strStylesInDoc) + 1)
    strStylesInDoc(UBound(strStylesInDoc)) = paraTemp.Style.NameLocal
    End If
    Next paraTemp

    ' All paragraph syles used in the document are now in the array strStylesInDoc
    For i = 1 To UBound(strStylesInDoc)
    ActiveDocument.Content.InsertAfter vbCrLf & strStylesInDoc(i)
    Next i

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •