Home » Questions » Computers [ Ask a new question ]

Can I use leaders (or equivalent) inside tables in Word 2007?

Can I use leaders (or equivalent) inside tables in Word 2007?

I want to layout something like the following:

Asked by: Guest | Views: 245
Total answers/comments: 2
Guest [Entry]

"There is no way to do this with the Word GUI.

Here is a Macro that will automatically fill all blank cells in a document with a tab leader that fills the cell exactly.

Sub FillCellsWithTabLeader()
'
' Fill cells with tab leader Macro
'
'

For Each tbl In ActiveDocument.Tables
FillCells (tbl)
Next tbl

End Sub

Function FillCells(tbl)

For Each acell In tbl.Cells

For Each ntbl In acell.Tables
FillCells (ntbl)
Next ntbl

acell.Select
Set rngtable = acell.Range
rngtable.MoveEnd Unit:=wdCharacter, Count:=-1
If rngtable.Text = """" Then

Selection.ParagraphFormat.TabStops.Add Position:=acell.Width - (acell.LeftPadding + acell.RightPadding), _
Alignment:=wdAlignTabLeft, leader:=wdTabLeaderDots
Selection.TypeText Text:=vbTab
End If
Next acell
End Function

Layout your document, then make a master backup copy before applying this macro. Then if you need to make changes just use your master to create a new copy and run the macro again.

To use this macro code:

Choose File > Word Options
Check 'Show Developer tab in the ribbon'
Go to the Developer tab and click 'Macros'
Type the name 'FillCellsWithTabLeader'
Click 'Create'
Copy & Paste this code over the pre-generated code stub.
Close the VBA Window.
Click Macros, select FillCellsWithTabLeader and click Run to run the code."
Guest [Entry]

"Although I didn't fully read akf's answer, my answer can be though of as identical in nature except for a finer point, where you actually use the tables limits in your favor.

My end result is the following:

The process is the following:

Create a table such that you have a column for every text element (e.g. the questions), the leaders and the space you left between them.
Select the whole table and then remove All Limits.
Select the cells that you want to have the ""leader dots"", then right-click and go to Borders and Shading.
In the Borders tab, click in Personalize at the left.
Select the dotted line (2nd) and the line width as 1 1/2 pts.
In the cell layout select the center and bottom horizontal limits. Confirm.

You should get a similar result to mine. AFAIK this dialog exists even in earlier versions of Word."