'Interop with MS Excel

I am trying to write a set of data to excel file using VB.NET. While using the function Autofit() following error is returned at run time:

System.Runtime.InteropServices.COMException: '0x800A03EC'

The exact line of code which I have written is given below.

shXL.Range("A", "I").Rows.AutoFit()

where shXL is the worksheet definition.

All other functions on shXL are executing properly.



Solution 1:[1]

I too don't understand why you're specifying columns for autofitting the rows but try this ...

shXL.Range("A:I").Rows.AutoFit()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Skin