Jammy
04-13-2016, 03:30 AM
This macro adapted from one found on MSDN exports a list of Word styles to a new document.
I would like to format "NameLocal" as bold (or Heading 1) and leave the "Description" text unformatted.
I'd greatly appreciate if anyone can help with the syntax.
Sub exportStyles()
Dim docActive As Document
Dim docNew As Document
Dim styleLoop As Style
Set docActive = ActiveDocument
Set docNew = Documents.Add
For Each styleLoop In docActive.Styles
With docNew.Range
Selection.Font.Bold = True
.InsertAfter Text:=styleLoop.NameLocal & Chr(9)
.InsertParagraphAfter
.InsertAfter Text:=styleLoop.Description
.InsertParagraphAfter
End With
Next styleLoop
End Sub
I would like to format "NameLocal" as bold (or Heading 1) and leave the "Description" text unformatted.
I'd greatly appreciate if anyone can help with the syntax.
Sub exportStyles()
Dim docActive As Document
Dim docNew As Document
Dim styleLoop As Style
Set docActive = ActiveDocument
Set docNew = Documents.Add
For Each styleLoop In docActive.Styles
With docNew.Range
Selection.Font.Bold = True
.InsertAfter Text:=styleLoop.NameLocal & Chr(9)
.InsertParagraphAfter
.InsertAfter Text:=styleLoop.Description
.InsertParagraphAfter
End With
Next styleLoop
End Sub