![]() |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#9
|
||||
|
||||
|
Quote:
I've tried it, however, it gave me an error message, Re the line: .Borders(wdBorderBottom).LineWidth = iLineWidth. I don't know how to fix it, however, I'm glad to have fixed my above script. I've even added on the same row a Top and Bottom Value as InputBoxes. I've replaced ''As Variant'' for ''WdLineWidth'', Works great. My script is maybe not as a pro like yourself would do it, but for No formal training, just analyzing scripts, I can say I'm getting not bad, right? Please give me a bone ''encouragement'' .Here is my script: Code:
Dim aTbl As Table
Dim sVar1 As WdLineWidth 'First Row - Top border
Dim sVar2 As WdLineWidth 'First Row - Bottom border
Dim LineWidth As Borders
Set aTbl = ActiveDocument.Tables(1)
sVar1 = InputBox("For First Row, Enter the value on Top from the below numbers before the = symbole." _
& 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")
sVar2 = InputBox("For First Row, Enter the value on Bottom from the below numbers before the = symbole." _
& 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")
With Selection.Tables(1)
.Rows.First.Range.Select
End With
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
On Error GoTo 0
Code:
'sVar1 = aTbl.Borders(wdBorderTop).LineWidth Once I know how to do this, I could now try to do it to all tables in a document. At times, I have over 80 tables in a document, which takes me much times, to fix them to be constant. From the bottom of my heart, thank you for guiding me and helping me or anyone with those type of script's ![]() Cendrinne Last edited by Cendrinne; 09-06-2022 at 12:09 AM. Reason: Edited the comma's for decimal and put dot. Sorry my pc is in French. |
| 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 |
How is a variant array created to pass properties to a style?
|
Peterson | Word VBA | 2 | 09-06-2021 05:52 PM |
table over 2 pages without borders
|
ljosmynd | Word Tables | 1 | 02-02-2016 12:29 AM |
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 |