Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' purpose: apply style to paragraph based on left indent value
- ' tags: VBA Macro Word 2007
- Sub ParagraphStyleByLeftIndent()
- Dim p As Paragraph
- For Each p In ActiveDocument.Paragraphs
- If p.Style = ActiveDocument.Styles("List Style 1") Then
- ElseIf p.Style = ActiveDocument.Styles("List Style 2") Then
- ElseIf p.Style = ActiveDocument.Styles("List Style 3") Then
- ElseIf p.Style = ActiveDocument.Styles("List Style 4") Then
- ElseIf p.Format.LeftIndent = 36 Then
- p.Style = ActiveDocument.Styles("List Style 1")
- ElseIf p.Format.LeftIndent = 57.6 Then
- p.Style = ActiveDocument.Styles("List Style 2")
- ElseIf p.Format.LeftIndent = 79.2 Then
- p.Style = ActiveDocument.Styles("List Style 3")
- ElseIf p.Format.LeftIndent = 104.4 Then
- p.Style = ActiveDocument.Styles("List Style 4")
- Else
- Debug.Print p.Format.LeftIndent
- Debug.Print p.Range.Text
- Exit Sub
- End If
- Next
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement