Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-29-2021, 02:59 AM
Shelley Lou Shelley Lou is offline VBA convert to table - format Column 1 Windows 10 VBA convert to table - format Column 1 Office 2016
Expert
VBA convert to table - format Column 1
 
Join Date: Dec 2020
Posts: 259
Shelley Lou is on a distinguished road
Default VBA convert to table - format Column 1

Hi Guys, I have a macro that converts text to table format which works fine but I want to fine tune it a bit. Column 1 is set to 2.7 width (house style). I want to further format Column 1 to be left aligned (not justified) and indented to 1". I've tried all sorts within the macro but nothing seem to be working and I would be very grateful if someone could help me. Many thanks, Shelley

Code:
Sub DPU_Tables()
    Selection.WholeStory
    Selection.Font.Name = "Arial"
    Selection.Font.Size = 10
    With Selection.ParagraphFormat
        .SpaceBefore = 0
        .SpaceBeforeAuto = False
        .SpaceAfter = 9
        .SpaceAfterAuto = False
        .LineSpacingRule = wdLineSpaceAtLeast
        .LineSpacing = 15
        .LineUnitBefore = 0
        .LineUnitAfter = 0
    End With
    Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
    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
    End With
   Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
    Selection.Columns(1).PreferredWidth = InchesToPoints(2.7)
    Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
    Selection.Columns(2).PreferredWidth = InchesToPoints(3.63)
    Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
    Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.Borders(wdBorderTop).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderRight).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderVertical).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderDiagonalDown).LineStyle = wdLineStyleNone
    Selection.Borders(wdBorderDiagonalUp).LineStyle = wdLineStyleNone
End Sub

Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA convert to table - format Column 1 Macro to convert table to convert table into iCalendar file? Weboh Word VBA 5 12-10-2016 03:07 PM
VBA convert to table - format Column 1 Copying DNA from web and need to convert column date to ex: 11-15 JacMUr2 Excel 2 01-22-2016 03:36 AM
VBA to Format a Table Column in Excel Sgt Rock Excel 0 02-14-2015 02:54 PM
How can I temporarily break a 3 column format in order to type a single column paragraph William P Word 1 01-04-2015 06:40 PM
VBA convert to table - format Column 1 1.image in a table 2.right click 3.menu click format 4.a format column appears OldFatDog Drawing and Graphics 1 06-13-2014 11:19 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:27 PM.


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