Please, read this article:
Achieving Backward Compatibility with .NET Interop: Excel as Case Study[
^]
An author of above article states that:
Quote:
[System.Runtime.InteropServices.COMException] -2147352559 (80020011) Does not support a collection.
The above code produces this error when compiled on an Excel 2003 machine and run on Excel 2000
There are three ways to work around this error:
- Build your project on different machines for compatibility with each respective version of Office.
- Install different versions of Office on your build machine (How-to).
- Use "Late Binding" to call whatever version of Office is available at run-time
BTW: To merge cells, use
Range.Merge()[
^] method.
Finally, use this code to add text to merged range:
oRange= oSheet.Range("A3:H3")
oRange.Cells(1,1).Value = "Whatever"
as is described here:
Range.MergeCells Property (Excel)[
^]
It inserts text into top-left cell of merged area.
[EDIT]
Late binding version of the part of your code:
oApp = CreateObject("Excel.Application")
You have to repeat this step for every other object:
oWbk = oApp.Workbooks.Add
oWsh = oWbk.Worksheets(1)
oRange = oWsh.Range("A1")
oRange.EntireColumn.ColumnWidth = 8.43
oWsh.Rows(1).RowHeight = 69
oWhs.Shapes.AddPicture(folder & "JubHeader.jpg", 0, -1, 0, 0, 445.9, 68.33)
Shapes.AddPicture method (Microsoft.Office.Interop.Excel)[
^]
MsoTriState Enumeration [Object Library Reference for the 2007 Microsoft Office System][
^]
XlUnderlineStyle Enumeration [Excel 2007 Developer Reference][
^]
Good luck!