Word Table formatting question

J

Joe

I am using Word 2002 and have several tables in my document. Here is the code that I have that formats the borders in my tables after all of them have been created

Dim tbl As Word.Tabl
For Each tbl In ActiveDocument.Table
With tbl.Border
.Enable = Tru
.InsideLineStyle = wdLineStyleSingl
.OutsideLineStyle = wdLineStyleSingl
End Wit
Next tb

What I want to do is not have the horizontal lines appear in the first table. I know that to do this I would use the following

tbl.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNon

What I don't know how to do is identify the first table. There is no Index property

Do I need to do this ((I really just don't want to. I want to use a For Each instead of a For loop.)

Dim i As Intege
For i = 1 To ActiveDocument.Tables.Coun
With Table(i).Border
.Enable = Tru
.InsideLineStyle = wdLineStyleSingl
.OutsideLineStyle = wdLineStyleSingl
End Wit
If i = 1 then Table(i).Borders(wdBorderHorizontal).LineStyle = wdLineStyleNon
Next

Any information would be greatly appreciated

Thanks

Joe
 
J

JB

Couldn't you just assign a counter and increment it inside the For Each ?
Dim tbl As Word.Table
For Each tbl In ActiveDocument.Tables

i = i+1
if i = 1 then
tbl.Borders(wdBorderHorizontal).LineStyle = wdLineStyleNone
endif
With tbl.Borders
.Enable = True
.InsideLineStyle = wdLineStyleSingle
.OutsideLineStyle = wdLineStyleSingle
End With
Next tbl


or something like that?


HTH
J

Joe said:
I am using Word 2002 and have several tables in my document. Here is the
code that I have that formats the borders in my tables after all of them
have been created.
Dim tbl As Word.Table
For Each tbl In ActiveDocument.Tables
With tbl.Borders
.Enable = True
.InsideLineStyle = wdLineStyleSingle
.OutsideLineStyle = wdLineStyleSingle
End With
Next tbl

What I want to do is not have the horizontal lines appear in the first
table. I know that to do this I would use the following:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top