![]() |
|
#1
|
||||
|
||||
|
Hello Experts, Happy New Year, by the way
![]() I've been trying, searching, to find a way, to have either 1 table column 1 or all Tables column 1, to place a dot leader, and without needing to manually do a Ctrl+Tab on each row at the end of the text. Not funny when there is 40 rows, and 38 tables in a word Document. Is it possible or not? I've tried creating a style. Created a kb macro to select column 1 and have the Right Tab stop Dot leader put, but still, I have to manually do the Ctrl+Tab on each rows, at the end of the text. Frustrated. It doesn't happen often, maybe 2 a year, but it's so long when I know there must be a macro, script, that could ease my pain. I can't seem to find an answer. Unless I'm not asking the right way in my google search. Please help??? Last edited by Cendrinne; 01-20-2021 at 07:34 AM. |
|
#2
|
||||
|
||||
|
Never mind, I found a way
I've programmed it manually but it works regardless how many rows I have ![]() Code:
Sub Create_Dot_Leader_1Tbl_Col_1()
'
Application.ScreenUpdating = False
Dim oTbl As Table
Dim oRow As Row
Dim oCell As cell
Set oTbl = Selection.Tables(1)
With Selection.ParagraphFormat
.TextboxTightWrap = wdTightNone
.CollapsedByDefault = False
End With
Selection.ParagraphFormat.TabStops.ClearAll
ActiveDocument.DefaultTabStop = InchesToPoints(0.25)
Selection.ParagraphFormat.TabStops.Add Position:=InchesToPoints(5.25), _
Alignment:=wdAlignTabRight, Leader:=wdTabLeaderDots
oTbl.Columns(1).Select
For Each oRow In oTbl.Rows
Selection.SelectRow
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=vbTab
Selection.Move Unit:=wdRow, Count:=1
Next oRow
On Error Resume Next
Application.ScreenUpdating = True
On Error GoTo 0
End Sub
![]() Cendrinne |
|
#3
|
||||
|
||||
|
I have a couple of questions for only the dots per row.
Is there a way to have only the dots spaced out to 2 pt? And Is there a way, that the dots NOT be Bold, regardless if the Start of the cell is Bold? |
|
#4
|
||||
|
||||
|
Found that too. I've done all manually, but tweaked it with scripts from other tables and rows.
Code:
Sub Create_Dot_Leader_1Tbl_Col_1_SpacedOut()
Application.ScreenUpdating = False
Dim oTbl As Table
Dim oRow As Row
Dim oCell As cell
Set oTbl = Selection.Tables(1)
With Selection.ParagraphFormat
.TextboxTightWrap = wdTightNone
.CollapsedByDefault = False
End With
Selection.ParagraphFormat.TabStops.ClearAll
ActiveDocument.DefaultTabStop = InchesToPoints(0.25)
Selection.ParagraphFormat.TabStops.Add Position:=InchesToPoints(5.25), _
Alignment:=wdAlignTabRight, Leader:=wdTabLeaderDots
oTbl.Columns(1).Select
For Each oRow In oTbl.Rows
Selection.SelectRow
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine
Selection.TypeText Text:=vbTab
Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
With Selection.Font
.Bold = False
.Color = wdColorAutomatic
.Superscript = False
.Subscript = False
.Spacing = 2
.Scaling = 100
.Position = 0
End With
Selection.Move Unit:=wdRow, Count:=1
Next oRow
On Error Resume Next
Application.ScreenUpdating = True
On Error GoTo 0
End Sub
|
|
#5
|
||||
|
||||
|
Not bad for an Advance Beginner
![]() Now all I have to firgure out, is apply it to all tables in a word document. Any suggestion is welcome
|
|
#6
|
|||
|
|||
|
Not exactly sure what you are trying to do. First, it seems your code could be written:
Code:
Sub Create_Dot_Leader_1Tbl_Col_1_SpacedOut()
Dim oTbl As Table
Dim oRow As Row
Dim oCell As Cell
Dim oRng As Range
Application.ScreenUpdating = False
Set oTbl = Selection.Tables(1)
oTbl.Columns(1).Select
With Selection.ParagraphFormat
.TextboxTightWrap = wdTightNone
.CollapsedByDefault = False
.TabStops.ClearAll
.TabStops.Add Position:=InchesToPoints(5.25), _
Alignment:=wdAlignTabRight, Leader:=wdTabLeaderDots
End With
For Each oRow In oTbl.Rows
Set oRng = oRow.Cells(1).Range
With oRng
.End = .End - 1
.Collapse wdCollapseEnd
.InsertAfter vbTab
With .Font
.Bold = False
.Color = wdColorAutomatic
.Spacing = 2
End With
End With
Next oRow
Application.ScreenUpdating = True
lbl_Exit:
Exit Sub
End Sub
To process all tables then change to this: Code:
Sub Create_Dot_Leader_1Tbl_Col_1_SpacedOut()
Dim oTbl As Table
Dim oRow As Row
Dim oCell As Cell
Dim oRng As Range
Application.ScreenUpdating = False
For Each oTbl in ActiveDocument.Tables 'Set oTbl = Selection.Tables(1)
oTbl.Columns(1).Select
With Selection.ParagraphFormat
.TextboxTightWrap = wdTightNone
.CollapsedByDefault = False
.TabStops.ClearAll
.TabStops.Add Position:=InchesToPoints(5.25), _
Alignment:=wdAlignTabRight, Leader:=wdTabLeaderDots
End With
For Each oRow In oTbl.Rows
Set oRng = oRow.Cells(1).Range
With oRng
.End = .End - 1
.Collapse wdCollapseEnd
.InsertAfter vbTab
With .Font
.Bold = False
.Color = wdColorAutomatic
.Spacing = 2
End With
End With
Next oRow
Next oTbl
Application.ScreenUpdating = True
lbl_Exit:
Exit Sub
End Sub
|
|
#7
|
||||
|
||||
|
Greg!!!!!! Hello
![]() Thank you. I'll test it out later on tonight. What I was trying to do is have my first column with the Dot Leader. I had a situation, where all the Freaking tables had to have a dot leader. So manually, I had to do on each row of column 1, Ctrl+Tab, to show the Dots. I was discourage. Especially when the document was long. I don't have the skills of you guys experts, but see I've managed on my own. It worked, but I knew it wasn't a proper programing. Thanks hun I'll test it out and let you know tonight ![]() Cendrinne |
|
#8
|
||||
|
||||
|
Hello again, Greg, I've tested it. Wow, that will sure come handy when I get these frustrating documents. Thanks.
At first I got and error message, 5992, cause the Column Collection, are not the same size. Or something similar. I'm translating this from french. I've realized some top few rows, are merge together. Like Two columns are for Quarter 4, next two column are for Quarter 3 and that is for Row 1. So I've tried to split the first row from the rest and your macros (1 table & All tables) Works ![]() It would be challenging to find a way to tweak those top rows, cause from one table to another, I could have different number of Rows that have some merged columns. Your Macros, made my Whole Week or Month. WOW, I'm always impressed by programming Pro's skills. CALL ME IMPRESSED ![]() Thank you again soooo much. Cendrinne |
|
| Tags |
| dot leader table column 1 |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Table of Contents with authors and leader dots | nanoboy | Word | 2 | 07-18-2017 01:04 PM |
Dot spacing tab leader in automatic Table of Contents
|
Beunhaas | Word | 1 | 11-25-2015 10:27 AM |
Format tab leader in “Table of figures” separate from text?
|
WTR_girl12 | Word | 1 | 09-03-2015 10:48 AM |
Table of contents 2nd line dot leader right tab failure
|
Tsingher | Word | 2 | 01-18-2015 09:21 AM |
Dot leader in table cells
|
BeerStud | Word | 11 | 04-02-2014 07:28 AM |