Guest User

Untitled

a guest
May 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. Dim oStartHeadingParagraph As Paragraph
  2. Set oStartHeadingParagraph = Selection.Paragraphs(1)
  3.  
  4. If oStartHeadingParagraph.Style <> "Heading 1" Then
  5. MsgBox "Please select the Heading 1 paragraph for the section you want to delete."
  6. Else
  7.  
  8. Dim oParagraph As Paragraph
  9. Set oParagraph = oStartHeadingParagraph
  10.  
  11. Do While Not oStartHeadingParagraph.Next Is Nothing
  12. If oStartHeadingParagraph.Next.Style = "Heading 1" Then
  13. Exit Do
  14. Else
  15. oStartHeadingParagraph.Next.Range.Delete
  16. End If
  17. Loop
  18.  
  19. oStartHeadingParagraph.Range.Delete
  20.  
  21. End If
Add Comment
Please, Sign In to add comment