Table Column Width

Discussion in 'Word VBA' started by Pam, Nov 25, 2008.

  1. Pam

    Pam Guest

    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?
    Pam, Nov 25, 2008
    1. Advertisements

  2. Pam

    Helmut Weber Guest

    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)
    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
    Helmut Weber, Nov 25, 2008
    1. Advertisements

  3. Pam

    Pam Guest

    That worked great. Thank you so much!


    Pam, Nov 25, 2008
  4. Pam

    maddy01 Guest

    Helmut Weber wrote on 11/25/2008 12:16 ET
    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.
    a large data table and thus would appreciate if you can suggest any othe
    maddy01, Jul 13, 2013
  5. Pam

    Stefan Blom Guest

    Stefan Blom, Jul 15, 2013
  6. Tks.

    Douglas Salazar

    Em segunda-feira, 15 de julho de 2013 16h34min19s UTC-3, Stefan Blom escreveu:
    Douglas Salazar, Aug 25, 2013
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.