Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-24-2021, 07:12 AM
jeffreybrown jeffreybrown is offline Convert document to a multilevel list Windows 10 Convert document to a multilevel list Office 2016
Expert
Convert document to a multilevel list
 
Join Date: Apr 2016
Posts: 673
jeffreybrown has a spectacular aura aboutjeffreybrown has a spectacular aura about
Default

Hi Graham and thank you for your time. Yes, agreed. The formatting is horrible, but this is what I have to work with. As far as all the other formatting, I can take care of that, just really trying to understand the application of the Heading styles. Here is a cleaned up document and the macro I cobbled together which of course does not work entirely. This is just a shortened version of a 9 page document and then there are another 3 to format. Manual of course is an option, but not one I'm excited about. Can you give some suggestion on this macro and how it can be fixed to cover all of the letter/number combinations?

Code:
Sub ConvertStyle()
    Dim orng        As Range: Set orng = ActiveDocument.Range
    Dim opara       As Paragraph
    Dim oParRng     As Range
    Dim MyLtr       As String
    Dim MyStyle     As String
    
    For Each opara In orng.Paragraphs
        Set oParRng = opara.Range.Duplicate
        MyLtr = oParRng.Characters(1)
            
        Select Case MyLtr

            Case "I", "II", "III", "IV", "V", "VI": opara.Style = "Heading 1"
            Case "A", "B", "C", "D", "E", "F": opara.Style = "Heading 2"
            Case "1", "2", "3", "4", "5", "6": opara.Style = "Heading 3"
            Case "a", "b", "c", "d", "e", "f": opara.Style = "Heading 4"
            
        End Select
            
    Next opara
    
lbl_Exit:
    Exit Sub
End sub

Attached Files
File Type: docx T.docx (25.1 KB, 10 views)
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross-reference with full context a numbered list inside another multilevel list (list style) MatLcq Word 0 02-01-2021 06:00 AM
Convert multilevel bullet list to multilevel numbered list scadaman29325 Word 2 03-27-2020 03:27 PM
Convert document to a multilevel list convert multilevel list to a true outline markjkubicki Word 3 10-17-2018 10:12 AM
How to convert table into multilevel list? microsoftsloot Word 1 12-07-2015 10:55 PM
Convert document to a multilevel list Multilevel List leaderofmarines Word 2 07-02-2013 05:02 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft