Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 09-05-2022, 12:22 AM
Cendrinne's Avatar
Cendrinne Cendrinne 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 2019
Competent Performer
Help, Please, Table Borders LineWidth act as a Variant. Why Variant disregards my variant value?
 
Join Date: Aug 2019
Location: Montreal Quebec Canada
Posts: 200
Cendrinne is on a distinguished road
Default Help, Please, Table Borders LineWidth act as a Variant. Why Variant disregards my variant value?

Hello pros,
I've succeeded to create a macro for Table Borders LineWidth to act as a Variant for the Last Row, for the bottom border.

Re: LineWidth = (sVar1), it remains at 1,50pt. Why?

Code:
   
Sub Table_1_Borders_LastRow_Top_050pt_Bottom_Var()
   Dim aTbl As Table
   Dim sVar1 As Variant               'Border size for the bottom row, bottom border.
   Dim LineWidth As Borders

Set aTbl = ActiveDocument.Tables(1)

   With Selection.Tables(1)
       .Rows.Last.Range.Select
   End With

    sVar1 = InputBox("Enter the Border size for the bottom row, on bottom border." _
      & vbCr & "Exemple en pt : 0.25, 0.50, 0.75, 1.00, 1.50, 2.25, 3.00, 4.50, 6.00.", "SUGGESTION", "3")

sVar1 = aTbl.Borders(wdBorderBottom).LineWidth

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

        With .Borders(wdBorderBottom)
            .LineStyle = wdLineStyleSingle
           '.LineWidth = wdLineWidth150pt
            .LineWidth = sVar1
            .Color = wdColorAutomatic
        End With
     End With
  
  On Error GoTo 0

End Sub
I've just edited my question, cause Trial and Error, I got it to work without error message. BUT, now the variant value, is Disregarded, and it puts 1.50 pt regardless the value I put as a variant.



What am I doing wrong, in your opinion?

Could any expert guide me please? I would be sooooo grateful.

Cendrinne

Last edited by Cendrinne; 09-05-2022 at 02:27 AM. Reason: Got it to work, but still have an issue.....
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 10:54 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