Table Column Width

P

Pam

I have a table in Word 2007 in which I want the first column to be 1 inch and
the second column to be 5.5 inches. I tried recording the keystrokes, but I
get this error: Run-time error 5992: Cannot access individual columns in
this collection because the table has mixed cell widths. I can't get the
columns to be two separate widths. Can you help?
 
H

Helmut Weber

Hi Pam,
I have a table in Word 2007 in which I want the first column to be 1 inch and
the second column to be 5.5 inches. I tried recording the keystrokes, but I
get this error: Run-time error 5992: Cannot access individual columns in
this collection because the table has mixed cell widths. I can't get the
columns to be two separate widths. Can you help?

You may try:

Sub Test699()
Dim oRow As Row
Dim oTbl As Table
Set oTbl = ActiveDocument.Tables(1)
With oTbl
For Each oRow In oTbl.Range.Rows
oRow.Cells(1).Width = InchesToPoints(1)
oRow.Cells(2).Width = InchesToPoints(5.5)
Next
End With
End Sub

The reasons, why a seemably uniform table,
that is, has equally wide cells in it's columns,
are endless and to a good deal unknown.

But accessing a row's cells collection,
usually works well.

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
P

Pam

That worked great. Thank you so much!

Pam

Helmut Weber said:
Hi Pam,


You may try:

Sub Test699()
Dim oRow As Row
Dim oTbl As Table
Set oTbl = ActiveDocument.Tables(1)
With oTbl
For Each oRow In oTbl.Range.Rows
oRow.Cells(1).Width = InchesToPoints(1)
oRow.Cells(2).Width = InchesToPoints(5.5)
Next
End With
End Sub

The reasons, why a seemably uniform table,
that is, has equally wide cells in it's columns,
are endless and to a good deal unknown.

But accessing a row's cells collection,
usually works well.

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP
 
M

maddy01

Helmut Weber wrote on 11/25/2008 12:16 ET
Hi Pam


You may try

Sub Test699(
Dim oRow As Ro
Dim oTbl As Tabl
Set oTbl = ActiveDocument.Tables(1
With oTb
For Each oRow In oTbl.Range.Row
oRow.Cells(1).Width = InchesToPoints(1
oRow.Cells(2).Width = InchesToPoints(5.5
Nex
End Wit
End Su

The reasons, why a seemably uniform table
that is, has equally wide cells in it's columns
are endless and to a good deal unknown

But accessing a row's cells collection
usually works well


Greetings from Bavaria, German

Helmut Weber, MVP WordVB

Vista Small Business, Office X
Hi Helmut
I too was having the same problem as Pam and tried your suggestion but th
problem is that this way i have to change width for each individual cell.
hav
a large data table and thus would appreciate if you can suggest any othe
alternative.
 
D

Douglas Salazar

Tks.

Douglas Salazar
@dodo_salazar

Em segunda-feira, 15 de julho de 2013 16h34min19s UTC-3, Stefan Blom escreveu:
 

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