Thread: [Solved] Need a macro adjustment
View Single Post
 
Old 12-07-2021, 01:56 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,166
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

The preferred way to apply the left indent is to apply a table style since this is part of the table style and shouldn't be locally set. The second macro shows how to change the relevant attributes of your chosen table style if they weren't already correctly set.
Code:
Sub TablesResizeAll()
  Dim oTbl As Table
  For Each oTbl In ActiveDocument.Tables
    oTbl.AutoFitBehavior wdAutoFitFixed
    oTbl.PreferredWidthType = wdPreferredWidthPoints
    oTbl.PreferredWidth = InchesToPoints(7.2)
    oTbl.Style = "Table Grid"   'also turns header row, 1st column & banded rows on
  Next oTbl
End Sub

Sub SetupTableStyle()
  With ActiveDocument.Styles("Table Grid").Table
    .Alignment = wdAlignRowLeft
    .LeftIndent = InchesToPoints(0.3)
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote