Article ID: 188426
Article Last Modified on 1/23/2007
Sub InsertStyleNames()
' This example inserts the style name at the beginning of every
' paragraph in the active document.
Dim para As Object
' Move to beginning of document.
Selection.HomeKey Unit:=wdStory
For Each para In ActiveDocument.Paragraphs
' Move cursor to beginning of line.
Selection.HomeKey wdLine
' Inserts the style name and >> characters.
Selection.TypeText para.Style & ">>"
' Move to next paragraph.
Selection.Move wdParagraph
Next para
End Sub
163435 VBA: Programming Resources for Visual Basic for Applications
173707 OFF97: How to Run Sample Code from Knowledge Base Articles
Additional query words: kbcode kbmacro vba vb
Keywords: kbhowto kbmacroexample KB188426