Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 12-17-2020, 10:07 AM
Shelley Lou Shelley Lou is offline Macro to delete tabs in Word Windows 10 Macro to delete tabs in Word Office 2016
Expert
Macro to delete tabs in Word
 
Join Date: Dec 2020
Posts: 259
Shelley Lou is on a distinguished road
Default Macro to delete tabs in Word

I have updated the code to now convert the text to a 2 column table, I have set the width of both columns, removed the borders of the table to No Border and have justified the text. How can I set Column 1 to be left aligned but keep Column 2 as justified. I also need to include font as Arial 10 with line spacing of At Least 15pt. Can anyone help at all?

Code:
Sub DPU_converttexttotable()
   Selection.WholeStory
   'convert text to table 2 columns'
    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
     'width of column 1 to be 2.7 inches'
    Selection.Columns(1).PreferredWidth = InchesToPoints(2.7)
    Selection.Columns.PreferredWidthType = wdPreferredWidthPoints
    'width of column 2 to be 3.63 inches'
      Selection.Columns(2).PreferredWidth = InchesToPoints(3.63)
      'alignment of column 2 is Justify'
      Selection.ParagraphFormat.Alignment = wdAlignParagraphJustify
    Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    'remove borders of entire table'
    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
Macro to delete tabs in Word I need a macro to format images and remove tabs. help LuisXVI Word VBA 4 11-12-2018 03:12 PM
Macro to delete tabs in Word Macro to delete pages in Word 2007 staicumihai Word VBA 4 11-07-2018 01:14 AM
Macro to delete tabs in Word Need Word Macro to Delete Text rsrasc Word VBA 4 04-18-2018 11:32 PM
Tabs set along left edge of page; how to delete ginny Word 4 03-21-2018 08:07 PM
Macro to delete tabs in Word Word Macro to find and delete rows that contain adjacent cells containing "." AlexanderJohnWilley Word VBA 7 11-08-2012 10:15 AM

Other Forums: Access Forums

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