I have create a excel project using VSTO in .net 2005. It retrieves data from a web service.



I have a project template sheet, which has a list object on it. As I pull a dataset from the web service, it places the data in the list object. Then I take the project template sheet copy it and then rename it to the current project’s dataset.

I get a copy method failed after I have loaded approximately 100 sheets in the workbook. I have set up a button that auto loads the projects from list box.

This the error:

“System.Runtime.InterlopServices.COMException(0x800A03EC):Copy Method of worksheet class failed”



I have been searching and searching and I haven’t found the answer...

Here is a sample of my code:





currentListObject = Globals.ProjectTemplate.List1

currentListObject.AutoSetDataBoundColumnHeaders = False

currentListObject.SetDataBinding(dsData.Tables(0))

currentListObject.ShowTotals = False

currentListObject.Disconnect()







With Globals.ProjectTemplate

.Visible = Excel.XlSheetVisibility.xlSheetVisible

.Copy(, Globals.ThisWorkbook.Worksheets(1))

'.Copy(Globals.ProjectTemplate.InnerObject, ) ß I tried the method on MSDN and it failed(http://msdn2.microsoft.com/en-us/lib...heet.copy.aspx)

.Visible = Excel.XlSheetVisibility.xlSheetHidden

End With



Dim newSheet As Excel.Worksheet = DirectCast(Globals.ThisWorkbook.Sheets(2), Excel.Worksheet)