I need to loop through all the headings in the document and need to add new heading between Heading-2 and Heading-3. All existing headings are Heading 1 and I know the text.
I need to delete Heading-5.
The original file has 30000 more paragraphs; using old method takes too much time
for example here are the headings
1. Heading-1
2. Heading-2
3. Heading-3
4. Heading-4
5. Heading-5
6. Heading-6
For P = 1 To ActiveDocument.Paragraphs.Count - 1
ptext=ActiveDocument.Paragraphs(p).text
If Left(ActiveDocument.Paragraphs(P).Style, 9) = "Heading 1" Then
If InStr(1, ptext, "Heading-2") > 0 Then
ActiveDocument.Paragraphs.Add _
Range:=ActiveDocument.Paragraphs(P).Range
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:="Heading New"
End If
End If
Next