View Single Post
 
Old 02-18-2022, 01:58 AM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Windows 10 Office 2019
Competent Performer
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Red face Hello Graham, Let me show what I'm trying to do.....

Remember my previous post, about trying to find a way to affect all the column 1 from all Tables, well I found a solution to what I was aiming for.

I want to format all the tables to have it a certain Font, size, Row height, Row Space Before and After = 1 pt, Vertical alignment to the bottom, all other columns, apart from the column 1, I want to have a right indent of 0.08" = aligned to the RIGHT.

On Column 1, want to have a First line indent + start the column at 0.02", All align to the LEFT (reason I've put that part of the script at the end).

It does a WONDERFUL JOB, I'm so proud of myself to have figure this out.
However, I would need to do that from the start, cause all the work I've done on all the previous tables, where they had other requirements, would be lost. For example, some need more than 1 pt on certain rows.

Anyway, here is my Long Script but works

Code:
Application.ScreenUpdating = False

Dim xTbl As Table, aCel As Cell, i As Long

For Each xTbl In ActiveDocument.Tables
   With xTbl.Range
    .Rows.HeightRule = wdRowHeightAuto
    .Rows.Height = InchesToPoints(0)
    .Rows.AllowBreakAcrossPages = False
   End With
'Next xTbl

' Tbl_0SpcB4_Aft_Tbl_only Macro
   With xTbl.Range
    .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
'Next xTbl

  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 = 8
    Next
  End With

Next xTbl

Application.ScreenUpdating = True
    
   'End With
    On Error GoTo 0
And yes, I'm still confused with Select and Range. I don't master that part of the codes, so please forgive me, i'm not a pro or expert like you all are here from the forum.

But see, I'm not that bad, just needs more experience to graspe it.

OK, got to go to bed, way past my bed time. I'll try to check it up tomorrow morning, or on the weekend.

Thank you so much for your patience and efforts.
As you can see, I'm also trying my best.

Cendrinne
Reply With Quote