![]() |
|
#4
|
||||
|
||||
|
Your code works OK, but to make it run on a selection of tables set a range as in Macro2 of my last post i.e. the following will format the tables after the cursor position.
Code:
Dim xTbl As Table
Dim oRng As Range
Dim i As Long
Application.ScreenUpdating = False
Set oRng = ActiveDocument.Range(Selection.Range.Start, ActiveDocument.Range.End)
For Each xTbl In oRng.Tables
With xTbl.Range
.Rows.HeightRule = wdRowHeightAuto
.Rows.Height = InchesToPoints(0)
.Rows.AllowBreakAcrossPages = False
.Font.Size = 9
.Font.Name = "Calibri"
.ParagraphFormat.Alignment = wdAlignParagraphRight
.ParagraphFormat.LineSpacingRule = wdLineSpaceSingle
.ParagraphFormat.SpaceBefore = 1
.ParagraphFormat.SpaceBeforeAuto = False
.ParagraphFormat.SpaceAfter = 1
.ParagraphFormat.SpaceAfterAuto = False
.ParagraphFormat.RightIndent = InchesToPoints(0.08)
.Cells.VerticalAlignment = wdCellAlignVerticalBottom
End With
With xTbl.Columns(1)
For i = 1 To .Cells.Count
.Cells(i).Range.Font.Size = 9
.Cells(i).Range.Font.Name = "Calibri Light"
.Cells(i).Range.ParagraphFormat.Alignment = wdAlignParagraphLeft
.Cells(i).Range.ParagraphFormat.LeftIndent = InchesToPoints(0.13)
.Cells(i).Range.ParagraphFormat.RightIndent = InchesToPoints(0)
.Cells(i).Range.ParagraphFormat.FirstLineIndent = InchesToPoints(-0.11)
.Cells(i).Range.ParagraphFormat.SpaceBefore = 1
.Cells(i).Range.ParagraphFormat.SpaceAfter = 1
.Cells(i).Range.Cells.VerticalAlignment = wdCellAlignVerticalBottom
Next
End With
With xTbl.Rows(1)
For i = 1 To .Cells.Count
.Cells(i).Range.Font.Size = 12
Next
End With
Next xTbl
Application.ScreenUpdating = True
Set xTbl = Nothing
Set oRng = Nothing
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
| Tags |
| collapse, help please |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help please, Script to Delete Paragraph marks b4 Tables | Cendrinne | Word VBA | 4 | 02-08-2022 06:54 PM |
| Help with a script to find Duplicate data in the same row of a table or tables | Cendrinne | Word VBA | 9 | 09-07-2021 07:54 PM |
| Need Help to Script to align all the tables only as of a section to end of doc? | Cendrinne | Word VBA | 4 | 04-05-2021 11:37 AM |
| Printing Word-Tables as PDFs without making the borders 1 point | Tobinobi | Word Tables | 3 | 12-12-2017 10:29 AM |
| Script starts nesting tables without reason | selman555 | Word VBA | 1 | 10-17-2014 01:01 AM |