Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel returns hresult 0x800A03EC at inserting Hyperlinks (C#)
Hi!
I have a C# App which creates a Excel Sheet where Hyperlinks are included. If i create the file the first time or create a new Sheet it runs without problems. But if i open the existing Sheet or add a new one and try to append the new items to the existing items i get the hresult error message. I reproduced the problem down to the call where i add the hyperlinks to the sheet. Here is the code-fragment: Here i open the Excel App and open the Workbook and Worksheet! Excel.ApplicationClass excelApp = new Excel.ApplicationClass(); excelApp.Visible = false; Excel.Workbook newWorkbook newWorkbook = excelApp.Workbooks.Open (ReportFile, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing); Excel.Sheets sheets = newWorkbook.Worksheets; Excel._Worksheet workSheet = (Excel._Worksheet)sheets.get_Item (sheets.Count); After that i run through the items i want to add. If i remove the Hyperlink.Add call the items are added and everythink works fine. intExcelRow is the Line where i want to add the new item. Excel.Range itemRange = workSheet.get_Range("A" + intExcelRow.ToString (), "AQ" + intExcelRow.ToString()); object[] objItem = new Object[1]; objItem[0] = excelItem; itemRange.GetType().InvokeMember("Value", System.Reflection.BindingFlags.SetProperty, null, itemRange, objItem); workSheet.Hyperlinks.Add((Excel.Range)itemRange.Ce lls[1, 2], "http://www.google.de/", Type.Missing, Type.Missing, "http://www.google.de/"); I changed the Call to workSheet.Hyperlinks.Add(workSheet.get_Range("B" + intExcelRow.ToString (), Type.Missing), "http://www.google.de/", Type.Missing, Type.Missing, "http://www.google.de/") without any luck Any help would be great Matthias |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Inserting carriage returns in Excel cells | Excel Discussion (Misc queries) | |||
Exception from HRESULT: 0x800A03EC | New Users to Excel | |||
How can I prevent Excel 2000 from inserting hyperlinks? | Setting up and Configuration of Excel | |||
0x800A03EC, asp and excel export | Excel Programming | |||
Chart.Export throws COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC. | Excel Programming |