Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-26-2021, 06:38 AM
Shelley Lou Shelley Lou is offline VBA converting manual numbering to auto numbering Windows 10 VBA converting manual numbering to auto numbering Office 2016
Expert
VBA converting manual numbering to auto numbering
 
Join Date: Dec 2020
Posts: 259
Shelley Lou is on a distinguished road
Default VBA converting manual numbering to auto numbering

Hi, I want to update a text to tables macro to include converting all manual numbering that starts at the beginning of a paragraph in the second column e.g. (a), (b), (i), (ii), (A), (B), (1), (2) to the correct auto numbering styles of my template: (a) Definitions Level 1; (i) Definitions Level 2; (A) Definitions Level 3; (1) Definitions Level 4. It also needs to restart numbering when it is related to a new definition. Would anybody be able to help me achieve this in my current macro? I have attached a test Word document so you can see the styles in the styles pane and how they should appear in the second column. Thanks, Shelley



Code:
Sub DPU_TextToTables()
  Dim oBorder As Border
    Selection.WholeStory
    Selection.ConvertToTable Separator:=wdSeparateByTabs, NumColumns:=2, _
    NumRows:=8, AutoFitBehavior:=wdAutoFitFixed
    With Selection.Tables(1)
        .Style = "Table Grid"
        .ApplyStyleHeadingRows = True
        .ApplyStyleLastRow = False
        .ApplyStyleFirstColumn = True
        .ApplyStyleLastColumn = False
        With .Range
            .Font.Name = "Arial"
            .Font.Size = 10
            With .ParagraphFormat
                .SpaceBefore = 0
                .SpaceBeforeAuto = False
                .SpaceAfter = 9
                .SpaceAfterAuto = False
                .LineSpacingRule = wdLineSpaceAtLeast
                .LineSpacing = 15
                .LineUnitBefore = 0
                .LineUnitAfter = 0
            End With
        End With
        With .Columns(1)
            .PreferredWidth = InchesToPoints(2.7)
            .Select
            With Selection.ParagraphFormat
                .Alignment = wdAlignParagraphLeft
                .LeftIndent = InchesToPoints(1)
          End With
            For Each oBorder In .Borders
            oBorder.LineStyle = wdLineStyleNone
            Next oBorder
            End With
        With .Columns(2)
            .Select
            With Selection.ParagraphFormat
                .Alignment = wdAlignParagraphJustify
            End With
            .PreferredWidth = InchesToPoints(3.63)
            For Each oBorder In .Borders
                oBorder.LineStyle = wdLineStyleNone
            Next oBorder
        End With
    End With
End Sub
Attached Files
File Type: docx definitions table.docx (20.9 KB, 15 views)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA converting manual numbering to auto numbering Applying New Multi-Level List to Existing Document with Manual Numbering and Existing Styles stanley Word 4 12-15-2020 10:59 AM
page numbering for manual Bursal Word 1 07-29-2018 02:08 PM
VBA converting manual numbering to auto numbering List Numbering Set Numbering Value shows missing numbers as hidden text lostenfeld Word 9 01-03-2017 04:27 PM
Auto numbering macro desireemm1 Word 1 12-10-2015 07:50 PM
VBA converting manual numbering to auto numbering auto page numbering socomfort Word 2 05-28-2012 04:19 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:59 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