Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 09-05-2022, 11:14 PM
Guessed's Avatar
Guessed Guessed is offline Help, Please, Table Borders LineWidth act as a Variant. Why Variant disregards my variant value? Windows 10 Help, Please, Table Borders LineWidth act as a Variant. Why Variant disregards my variant value? 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
 

Tags
borders, help please, variant



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with table borders synint Word 2 12-02-2021 01:44 AM
Help, Please, Table Borders LineWidth act as a Variant. Why Variant disregards my variant value? How is a variant array created to pass properties to a style? Peterson Word VBA 2 09-06-2021 05:52 PM
Help, Please, Table Borders LineWidth act as a Variant. Why Variant disregards my variant value? table over 2 pages without borders ljosmynd Word Tables 1 02-02-2016 12:29 AM
Help, Please, Table Borders LineWidth act as a Variant. Why Variant disregards my variant value? Page-crossing borders in a table with hidden between-cell borders tenpaiman Word 2 08-08-2012 07:20 PM
how can i make random variant neezeen Word 0 11-22-2011 08:08 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:57 PM.


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