Column.Left?

G

Guy Cohen

Hi all,

I use VB6 code to generate a word document with a table in it.

I want the last column to be the max possible width (depends on the
paper...)

I was told to use: Doc.PageSetup.PageWidth to get the paper width...

How do I get the column left position? so I can set the width = delta?

TIA
Guy
 
D

Doug Robbins - Word MVP

Hi Guy,

Use the following:

Dim i As Long, j As Long, k As Long
j = 0
For i = 1 To ActiveDocument.Tables(1).Columns.Count - 1
j = j + ActiveDocument.Tables(1).Columns(i).Width
Next i
With ActiveDocument.PageSetup
k = .PageWidth
k = k - .RightMargin
k = k - .LeftMargin
End With
With ActiveDocument.Tables(1)
k = k + .LeftPadding
k = k + .RightPadding
End With
ActiveDocument.Tables(1).Columns(i).Width = k - j


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

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