Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 02-18-2022, 01:58 AM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Help with script - Collapse Tables as of a point till the end of doc Windows 10 Help with script - Collapse Tables as of a point till the end of doc Office 2019
Competent Performer
Help with script - Collapse Tables as of a point till the end of doc
 
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
 

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

Other Forums: Access Forums

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