rot13 Posted August 31, 2006 Posted August 31, 2006 I'm automating a report where I have to pull data from a database and copy a template worksheet in the workbook and rename it for each 'campaign' i get back from the database. When doing this, I get the following COMException: "The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT))" Error Code: -2147417851 The code I have at the moment: worksheet = DirectCast(workbook.Worksheets("(campaign name)"), Excel.Worksheet) Dim newWorksheet As Excel.Worksheet = DirectCast(workbook.Worksheets.Add(), Excel.Worksheet) worksheet.Copy(, newWorksheet) worksheet = DirectCast(workbook.Worksheets("(campaign name) (2)"), Excel.Worksheet) worksheet.Name = cmp.Description worksheet.Visible = Excel.XlSheetVisibility.xlSheetVisible That's not what I started with... I've been trying different ways of copying and pasting, and it all gets me pretty much the same result...except sometimes I get a messagebox as well as the exception box that says the memory could not be read, or something like that. Anyone have any clue what could be causing this? The file isn't readonly, it isn't opened in readonly mode, and it is finding the '(campaign name)' worksheet... Quote
Recommended Posts