![]() |
|
#1
|
|||
|
|||
|
Hello,
i searched other threads but couldn't find the solution. no experience in vba. i wish to select all headings with multiple styles all at once and then delete them. any vba code on this? i found this macro selecting only heading 1 style. How to add additional styles in the code? Code:
Sub SelectHeadings()
'
' SelectHeadings Macro
'
'
Dim tempTable As Paragraph
Application.ScreenUpdating = False
ActiveDocument.DeleteAllEditableRanges wdEditorEveryone
For Each tempTable In ActiveDocument.Paragraphs
'Debug.Print tempTable.Range.Style & " " & wdStyleHeading1
If tempTable.Style = ActiveDocument.Styles(wdStyleHeading1) Then
'Debug.Print "aaa"
tempTable.Range.Editors.Add wdEditorEveryone
End If
Next
ActiveDocument.SelectAllEditableRanges wdEditorEveryone
ActiveDocument.DeleteAllEditableRanges wdEditorEveryone
Application.ScreenUpdating = True
End Sub
Last edited by macropod; 06-15-2021 at 02:58 PM. Reason: Added code tags & formatting |
| Tags |
| heading styles selection |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unable to get Styles to move headings. | Balliol | Word Tables | 0 | 10-12-2019 01:24 PM |
Applied Styles to Headings in Multi-Level List; now ALL second level headings are 1.XX
|
NNL | Word | 1 | 08-09-2017 02:52 PM |
Help with Styles - What is +Body and +Headings
|
spdoffice | Word | 8 | 12-18-2016 11:15 PM |
Creating new styles and applying numbering to headings - numbering not following from headings
|
Fuzzyflo | Word | 1 | 07-26-2016 04:34 AM |
| Headings and Styles. | Balliol | Word | 2 | 07-26-2013 12:41 AM |