Auto-Find table formatting

J

Justin Hess

Hi There,

I was wondering if it could be at all possible to use VBA to search through
a document and change the formatting of the tables. Basically what I want to
do is change all the dotted lines to grey (printing purposes) and all the 3/4
thick lines to 1/2. Any assistance will be greatly appreciated as my document
is about 100 pages long:( and each page consists of a number of tables.

Thanks
 
J

Jezebel

Dim pTable as word.table


for each pTable in ActiveDocument.Tables
with ptable.borders
.... [read help or experiment with intellisense to see what goes
here]
end with
next
 
H

Helmut Weber

Hi Justin,

this would be for the worstcase scenario,
when you have to check each single cell,
because dottet and 3/4 point lines are
to be found anywhere in a table.

Sub Makro1()
Dim rDcm As Range
Dim oTbl As Table
Dim oCll As Cell
Dim l As Long

Set rDcm = ActiveDocument.Range
For Each oTbl In rDcm.Tables
For Each oCll In oTbl.Range.Cells
With oCll
For l = -4 To -1
If .Borders(l).LineStyle = wdLineStyleSingle Then
If .Borders(l).LineWidth = wdLineWidth050pt Then
.Borders(l).LineWidth = wdLineWidth075pt
End If
End If
If .Borders(l).LineStyle = wdLineStyleDot Then
.Borders(l).Color = wdColorGray50
End If
Next
End With
Next
Next
End Sub
 
J

Justin Hess

Thankyou thankyou thankyou!!!! was in the process of converting to xml and
using find and replace with the code... you just made my weekend:)
 

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