View Single Post
 
Old 09-06-2022, 12:23 AM
Cendrinne's Avatar
Cendrinne Cendrinne is offline Windows 10 Office 2019
Competent Performer
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 190
Cendrinne is on a distinguished road
Default

Here is my script for all tables in a document. Had to rearrange the order of certain things. But this below works for me
For this bellow script, I've created for the Last Row:

Code:
 
   Dim xTbl As Table
   Dim sVar1 As WdLineWidth           'For the Last Row: Value to put as Top Border
   Dim sVar2 As WdLineWidth           'For the Last Row: Value to put as Bottom Border
   Dim LineWidth As Borders
    
    sVar1 = InputBox("Last Row - Enter the size value from the below choices before the symbole = for the Top Border." _
      & vbCr & "Exemple : 2 =0.25/ 4 =0.50/ 6 =0.75/ 8 =1.00/" _
      & vbCr & "12 =1.50/ 18 =2.25/ 24 =3.00/ 36 =4.50/ 48 =6.00.", "SUGGESTION", "8")

    sVar2 = InputBox("Last Row - Enter the size value from the below choices before the symbole = for the Bottom Border." _
      & vbCr & "Exemple : 2 =0.25/ 4 =0.50/ 6 =0.75/ 8 =1.00/" _
      & vbCr & "12 =1.50/ 18 =2.25/ 24 =3.00/ 36 =4.50/ 48 =6.00.", "SUGGESTION", "18")
    
    For Each xTbl In ActiveDocument.Tables
      xTbl.Rows.Last.Range.Select

     With Selection.Range
       With .Borders(wdBorderTop)
            .LineStyle = wdLineStyleSingle
            .LineWidth = sVar1
            .Color = wdColorAutomatic
       End With

       With .Borders(wdBorderBottom)
            .LineStyle = wdLineStyleSingle
            .LineWidth = sVar2
            .Color = wdColorAutomatic
       End With
     End With
  
   Next xTbl
  
  On Error GoTo 0
Hopefully it works for others on their PC's.

Cendrinne

Last edited by Cendrinne; 09-06-2022 at 12:27 AM. Reason: again, fixed commas, as decimals for dot's, since my system is in French.
Reply With Quote