View Single Post
 
Old 09-05-2022, 11:14 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,164
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

Try this variation. It shows the ONLY possible values that can be entered and defaults to the same value as the first table in the document. I've coded it to apply all the same bottom row border settings as the first table in the document and allows you to override the bottom border setting that the first table had (if you wish to choose something else).
I did this because your code referenced the first table in the document and the first table in the selection. Those tables may or may not be the same thing.
Code:
Sub Table_Borders_LastRow()
  Dim aTbl As Table, aTblSel As Table
  Dim iLineWidth As Integer               'Border size for the bottom row, bottom border.
  
  Set aTbl = ActiveDocument.Tables(1)
  Set aTblSel = Selection.Tables(1)
  iLineWidth = aTbl.Borders(wdBorderBottom).LineWidth    'size of bottom border on first table
  
  iLineWidth = InputBox("Enter the Border size for the bottom row/bottom border." & vbCr & _
      "Choices are: 2, 4, 6, 8, 12, 18, 24, 36, 48", "SUGGESTION", iLineWidth)     'suggestion = first table's border size
  
  With aTblSel.Rows.Last
    .Borders = aTbl.Rows.Last.Borders
    .Borders(wdBorderBottom).LineWidth = iLineWidth
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote