Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-27-2021, 03:56 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 convert manual numbering to auto numbering in table

Hi, yes you are quite right, I should have applied specific styles to the two columns. I have created a style called DefBold for Column 1 and DefText for Column 2. I have looked at the code you suggested but I can't understand it or how to apply it to my macro. How can I get the columns to change to these specific styles and possibly add them to the styles pane. The numbering levels (a), (i), (A), (1) then need to update from manual to their correct auto level. How can I do that. These definitions are converted from pdf to Word, I run one macro to do the formatting of the definitions first, check for errors then run the macro below to convert to a table.



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 test doc for definitions table.docx (21.0 KB, 19 views)
Reply With Quote
Reply



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 10:17 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