Cannot access individual columns ... error

From: Joe (anonymous_at_discussions.microsoft.com)
Date: 03/11/04


Date: Thu, 11 Mar 2004 08:16:22 -0800

I am getting the following error when I run my code from a DLL that creates a Word document.. Does anyone know what this means?

Cannot access individual columns in this collection because the table has mixed cell widths. (Error #5992).

The code is below and the error line is highlighted with '***********'

Thanks,

Joe

Code:

With wd
        With .Selection
            .Font.Bold = True
            .Font.Size = 16
            .Font.Color = wdColorWhite
            .Font.Shading.BackgroundPatternColor = wdColorGreen
            .TypeText vbTab & "NETWORK" & vbTab
            .Font.Shading.BackgroundPatternColor = wdColorWhite
            .TypeParagraph
            .TypeParagraph
            
            If wbk.Worksheets("Network").Range("VPN") <> "<Select>" Then

                .Font.Bold = True
                .Font.Size = 12
                .Font.Color = wdColorBlack
                .TypeText "Remote Access:"
                .TypeParagraph
                .TypeParagraph
                
                ' -- Connection Summary --
                .Font.Bold = True
                .Font.Size = 10
                .TypeText "Connection:"
                .Font.Bold = False
                .TypeParagraph
                
                .TypeText vbTab & vbTab & "VPN: "
                .TypeText wbk.Worksheets("Network").Range("VPN")
                .TypeParagraph
                
                .TypeText vbTab & vbTab & "VPN client vendor: "
                .TypeText wbk.Worksheets("Network").Range("VPNcvendor")
                .TypeParagraph
                
                .TypeText vbTab & vbTab & "VPN client version: "
                .TypeText wbk.Worksheets("Network").Range("VPNcversion")
                .TypeParagraph
                .TypeParagraph
                
                .TypeText vbTab & vbTab & "Dial access: "
                .TypeText wbk.Worksheets("Network").Range("Dial")
                .TypeParagraph
                
                .TypeText vbTab & vbTab & vbTab & "Modem Selection: "
                .TypeText wbk.Worksheets("Network").Range("CTXModem")
                .TypeParagraph
                
                .TypeText vbTab & vbTab & vbTab & "Backup to Primary remote access: "
                .TypeText wbk.Worksheets("Network").Range("VPNbackup")
                .TypeParagraph
                
                .TypeText vbTab & vbTab & "Comments: "
                .TypeText wbk.Worksheets("Network").Range("RemoteComment")
                .TypeParagraph
                .TypeParagraph
                
                ' -- Security Summary --
                .Font.Bold = True
                .TypeText "Security:"
                .Font.Bold = False
                .TypeParagraph
                
                .TypeText vbTab & "Password Requirements: "
                .TypeText wbk.Worksheets("Network").Range("PwdReqs")
                .TypeParagraph
                
                .TypeText vbTab & "Individual Access Agreement Required: "
                .TypeText wbk.Worksheets("Network").Range("IndAccess")
                .TypeParagraph
                
                .TypeText vbTab & "Background Check Required: "
                .TypeText wbk.Worksheets("Network").Range("BackCheck")
                .TypeParagraph
                .TypeParagraph
                
                ' -- Technical Contact Summary --
                .Font.Bold = True
                .TypeText "Technical Contact Information:"
                .Font.Bold = False
                .TypeParagraph
                
                .TypeText vbTab & "Contact Name: "
                .TypeText wbk.Worksheets("Network").Range("TechName")
                .TypeParagraph
                
                .TypeText vbTab & "Contact Phone: "
                .TypeText wbk.Worksheets("Network").Range("TechPhone")
                .TypeParagraph
                
                .TypeText vbTab & "Contact Email: "
                .TypeText wbk.Worksheets("Network").Range("TechEmail")
                .TypeParagraph
                .TypeParagraph
                
                ' -- Tools table --
                .Tables.Add Range:=.Range, NumRows:=7, NumColumns:=3
                iLastTable = .Tables.Count

 ********************** Error appears here *****************

                .Tables(iLastTable).Columns(1).SetWidth wd.InchesToPoints(2.5), wdAdjustNone
                .Tables(iLastTable).Columns(2).SetWidth wd.InchesToPoints(2), wdAdjustNone
                .Tables(iLastTable).Columns(3).SetWidth wd.InchesToPoints(2), wdAdjustNone

                .Tables(iLastTable).Cell(1, 1).Select
                .Range.Font.Bold = True
                .TypeText "Tool"
                .Shading.BackgroundPatternColor = wdColorGray15

                .Tables(iLastTable).Cell(1, 2).Select
                .Shading.BackgroundPatternColor = wdColorWhite
                .TypeText "Selection"

                .Tables(iLastTable).Cell(1, 3).Select
                .TypeText "Port Range"
                
                .Tables(iLastTable).Cell(2, 1).Select
                .TypeText "PcAnywhere"
                .Shading.BackgroundPatternColor = wdColorGray15

                .Tables(iLastTable).Cell(2, 2).Select
                .Shading.BackgroundPatternColor = wdColorWhite
                .TypeText wbk.Worksheets("Network").Range("Tpca")

                .Tables(iLastTable).Cell(2, 3).Select
                .TypeText "5631 (TCP), 5632 (UDP)"
                
                .Tables(iLastTable).Cell(2, 1).Select
                .TypeText "Terminal Services/RDP"
                .Shading.BackgroundPatternColor = wdColorGray15

                .Tables(iLastTable).Cell(2, 2).Select
                .Shading.BackgroundPatternColor = wdColorWhite
                .TypeText wbk.Worksheets("Network").Range("Trdp")

                .Tables(iLastTable).Cell(2, 3).Select
                .TypeText "3389"
                
                .Tables(iLastTable).Cell(2, 1).Select
                .TypeText "FTP"
                .Shading.BackgroundPatternColor = wdColorGray15

                .Tables(iLastTable).Cell(2, 2).Select
                .Shading.BackgroundPatternColor = wdColorWhite
                .TypeText wbk.Worksheets("Network").Range("Tftp")

                .Tables(iLastTable).Cell(2, 3).Select
                .TypeText "20-21"
                
                .Tables(iLastTable).Cell(2, 1).Select
                .TypeText "Telnet"
                .Shading.BackgroundPatternColor = wdColorGray15

                .Tables(iLastTable).Cell(2, 2).Select
                .Shading.BackgroundPatternColor = wdColorWhite
                .TypeText wbk.Worksheets("Network").Range("Ttelnet")

                .Tables(iLastTable).Cell(2, 3).Select
                .TypeText "23"
                
                .Tables(iLastTable).Cell(2, 1).Select
                .TypeText "SNMP"
                .Shading.BackgroundPatternColor = wdColorGray15

                .Tables(iLastTable).Cell(2, 2).Select
                .Shading.BackgroundPatternColor = wdColorWhite
                .TypeText wbk.Worksheets("Network").Range("Tsnmp")

                .Tables(iLastTable).Cell(2, 3).Select
                .TypeText "161-162(UDP)"
                
                .Tables(iLastTable).Cell(2, 1).Select
                .TypeText "SSH"
                .Shading.BackgroundPatternColor = wdColorGray15

                .Tables(iLastTable).Cell(2, 2).Select
                .Shading.BackgroundPatternColor = wdColorWhite
                .TypeText wbk.Worksheets("Network").Range("Tssh")

                .Tables(iLastTable).Cell(2, 3).Select
                .TypeText "22"
                
            End If
        End With
End With