We value your feedback.
Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!
Sub ListOutlineLevel1ParaMsgBox() Dim oPara As Paragraph Dim strMsg As String Dim rTmp As range ' a temporary range Dim lTmp As Long ' sections count Dim l2Tmp As Long Set rTmp = ActiveDocument.range 'Create start of message strMsg = "Outline Level 1: " & vbCr 'Iterate through all paragraphs in active document 'If style has outline level 1, append to message For Each oPara In ActiveDocument.Paragraphs If oPara.OutlineLevel = wdOutlineLevel1 Then ' strMsg = "Outline level 1: " & vbCr With oPara.range rTmp.End = .End ' redefine the temporary range lTmp = rTmp.Sections.count ' count the sections 'Append the heading number and text to the message strMsg = strMsg & " section: " & CStr(lTmp) strMsg = strMsg & " " & .ListFormat.ListString & " " & .Text _ & " " End With End If Next oPara MsgBox strMsg, vbOKOnly, "Summary Outline Level 1" End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Problem to line||23||79|
|Word 2016 - Message that someone else modified this document since I last opened it||12||48|
|adding "ungroup sheets" to existing vbs code||5||75|
|Webroot AV clears list of recently opened Word & Excel docs||2||50|
Join the community of 500,000 technology professionals and ask your questions.