View Single Post
 
Old 09-13-2022, 11:36 PM
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 Hi Greg, I've tried it but I'm not familiar how to fix it.......

Quote:
Originally Posted by gmaxey View Post
You could employ a simple userform with two listboxes and a command button. Let prone to user errors:

Code:
Option Explicit
Private Sub UserForm_Initialize()
 With ListBox1
   .AddItem
   .List(.ListCount - 1, 0) = "0.25 pt"
   .List(.ListCount - 1, 1) = 2
   .AddItem
   .List(.ListCount - 1, 0) = "0.50 pt"
   .List(.ListCount - 1, 1) = 4
   .AddItem
   .List(.ListCount - 1, 0) = "0.75 pt"
   .List(.ListCount - 1, 1) = 6
   .AddItem
   .List(.ListCount - 1, 0) = "1 pt"
   .List(.ListCount - 1, 1) = 8
   .AddItem
   .List(.ListCount - 1, 0) = "1.5 pt"
   .List(.ListCount - 1, 1) = 12
   .AddItem
   .List(.ListCount - 1, 0) = "2.25 pt"
   .List(.ListCount - 1, 1) = 18
   .AddItem
   .List(.ListCount - 1, 0) = "3.00 pt"
   .List(.ListCount - 1, 1) = 24
   .AddItem
   .List(.ListCount - 1, 0) = "4.5 pt"
   .List(.ListCount - 1, 1) = 36
   .AddItem
   .List(.ListCount - 1, 0) = "6 pt"
   .List(.ListCount - 1, 1) = 48
   .ListIndex = 3
  End With
  With ListBox2
    .List = ListBox1.List
    .ListIndex = 5
  End With
lbl_Exit:
  Exit Sub
End Sub

Private Sub CommandButton1_Click()
Dim oTbl As Table
  For Each oTbl In ActiveDocument.Tables
    oTbl.Rows.Last.Range.Select
    With Selection.Range
      With .Borders(wdBorderTop)
        .LineStyle = wdLineStyleSingle
        .LineWidth = ListBox1.Column(1)
        .Color = wdColorAutomatic
      End With
      With .Borders(wdBorderBottom)
        .LineStyle = wdLineStyleSingle
        .LineWidth = ListBox2.Column(1)
        .Color = wdColorAutomatic
      End With
    End With
  Next oTbl
lbl_Exit:
  Exit Sub
End Sub
You are WAY more advance than my level of knowledge. Wow, Wish you would make a book for less familiar people. Even stuff on your website, I'm not certain to understand lot's of contents.

Re this script,
I get an error message, and it highlights ListBox. It say's it's undefined Variable.
So I've tried to put Dim ListBox1 As ListBox, ListBox2 As ListBox = Worked but now it flags .AddItem

So I wish to have tried it, but I need more guidance to figure out what it's supposed to do.

But I'm truly grateful for your wanting to help me

Got to go to bed for now.

Night night
Reply With Quote