vs2012 excel 2016 interop exception when setting cell in column 257 RRS feed

  • Question

  • Using office 2010 PIAs (ver 14) for excel. Target computers are Windows 10 with Office 2016 installed.

    On ONE computer, I get an exception when setting a value in a cell in column 257, on all other computers this does not cause an exception, works fine.

    Failing code:

     For Each OITEM As BillingKey In oEquipmentKeyList
                With wsheet 

                  .Cells(Row, Col).Value = OITEM.BillingKey    <<------ Failing line
                    colnames.Add(Col, OITEM.BillingKey)
                    Col = Col + 1
                End With

    EXCEPTION happens when value if I = 257.

    Excel 2003 had the 256 column limitation, but not 2007 and above. Might there be something left behind GAC-wise or otherwise from an old installation of Office?

    At my wits end, why this works on all but one installation.

    Friday, December 30, 2016 11:22 PM

All replies

  • If the workbook is in the xls format, it will be limited to 256 columns, regardless of the capabilities of Excel 2007 & later. To access the additional columns, first save the workbook concerned in the xlsx or xlsm format, as appropriate.

    Paul Edstein
    [MS MVP - Word]

    Sunday, January 1, 2017 4:15 AM
  • Hi DJY64,

    I agree with the suggestion given by macropod.

    try to check the file format and if it incorrect then correct it.

    if solves your issue then mark the suggestion given by macropod as an answer.

    if still you have the same issue after changing the file format then post the error description.

    it will help us to understand the issue.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, January 2, 2017 2:45 AM