Discussion:
Table Column Width
(too old to reply)
Pam
2008-11-25 16:22:06 UTC
Permalink
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?
Helmut Weber
2008-11-25 17:16:06 UTC
Permalink
Hi Pam,
Post by 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
Pam
2008-11-25 19:12:01 UTC
Permalink
That worked great. Thank you so much!

Pam
Post by Helmut Weber
Hi Pam,
Post by 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?
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
maddy01
2013-07-13 15:10:12 UTC
Permalink
Helmut Weber wrote on 11/25/2008 12:16 ET
Post by Helmut Weber
Hi Pam
Post by Pam
I have a table in Word 2007 in which I want the first column to be 1 inch an
the second column to be 5.5 inches. I tried recording the keystrokes, but
get this error: Run-time error 5992: Cannot access individual columns i
this collection because the table has mixed cell widths. I can't get th
columns to be two separate widths. Can you help
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.
Stefan Blom
2013-07-15 19:34:19 UTC
Permalink
Since this newsgroup gets less attention these days, you may want to repost
in the programming forum in the Microsoft Community:

http://answers.microsoft.com/en-us/office/forum/customize?tab=all
--
Stefan Blom
Microsoft Word MVP
Post by Helmut Weber
Hi Pam,
Post by 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?
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
Hi Helmut,
I too was having the same problem as Pam and tried your suggestion but the
problem is that this way i have to change width for each individual cell.
I
have
a large data table and thus would appreciate if you can suggest any other
alternative.
Douglas Salazar
2013-08-25 01:14:11 UTC
Permalink
Tks.

Douglas Salazar
@dodo_salazar
Post by Stefan Blom
Since this newsgroup gets less attention these days, you may want to repost
http://answers.microsoft.com/en-us/office/forum/customize?tab=all
--
Stefan Blom
Microsoft Word MVP
Post by Helmut Weber
Hi Pam,
Post by 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?
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
Hi Helmut,
I too was having the same problem as Pam and tried your suggestion but the
problem is that this way i have to change width for each individual cell.
I
have
a large data table and thus would appreciate if you can suggest any other
alternative.
Continue reading on narkive:
Loading...