Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to open worksheet when called through a function
I am trying to open worksheet but it gives me the following error. This error
dosent occur every time. Its random. That's why I have put my code in try block. System.Runtime.InteropServices.COMException (0x8002801D): Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) at Microsoft.Office.Interop.Excel.Sheets.get__Default (Object Index) Following is my code snippet private void PasteData(string sSheet) { try { /* Open the corresponding sheet in the WorkSheet */ xlSheetScript = (Excel.Worksheet)xlBookScript.Worksheets[sSheet]; /* Find the last row in that sheet */ for (iCount = 400; iCount 0; iCount--) { xlRange = (Excel.Range)xlSheetScript.Cells[iCount, 2]; if (xlRange.Value2 != null) { break; } } Any help will be greatly appreciated. Thanks |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Simple Excel Problem
Please help me out with this Simple Excel Problem
"zoddiax" wrote: I am trying to open worksheet but it gives me the following error. This error dosent occur every time. Its random. That's why I have put my code in try block. System.Runtime.InteropServices.COMException (0x8002801D): Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) at Microsoft.Office.Interop.Excel.Sheets.get__Default (Object Index) Following is my code snippet private void PasteData(string sSheet) { try { /* Open the corresponding sheet in the WorkSheet */ xlSheetScript = (Excel.Worksheet)xlBookScript.Worksheets[sSheet]; /* Find the last row in that sheet */ for (iCount = 400; iCount 0; iCount--) { xlRange = (Excel.Range)xlSheetScript.Cells[iCount, 2]; if (xlRange.Value2 != null) { break; } } Any help will be greatly appreciated. Thanks |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to open worksheet when called through a function
Try this:
Open a cmd prompt and type: regsvr32 "%windir%\system32\cdosys.dll Regards, Michael Arch. Please rate this answer "zoddiax" wrote: I am trying to open worksheet but it gives me the following error. This error dosent occur every time. Its random. That's why I have put my code in try block. System.Runtime.InteropServices.COMException (0x8002801D): Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) at Microsoft.Office.Interop.Excel.Sheets.get__Default (Object Index) Following is my code snippet private void PasteData(string sSheet) { try { /* Open the corresponding sheet in the WorkSheet */ xlSheetScript = (Excel.Worksheet)xlBookScript.Worksheets[sSheet]; /* Find the last row in that sheet */ for (iCount = 400; iCount 0; iCount--) { xlRange = (Excel.Range)xlSheetScript.Cells[iCount, 2]; if (xlRange.Value2 != null) { break; } } Any help will be greatly appreciated. Thanks |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unable to open worksheet when called through a function
Hi Michael
Thanks for your answer but I am still getting the same error and its random. I get it 1 time for every 300 times or 400 times I run the code "Michael" wrote: Try this: Open a cmd prompt and type: regsvr32 "%windir%\system32\cdosys.dll Regards, Michael Arch. Please rate this answer "zoddiax" wrote: I am trying to open worksheet but it gives me the following error. This error dosent occur every time. Its random. That's why I have put my code in try block. System.Runtime.InteropServices.COMException (0x8002801D): Library not registered. (Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)) at Microsoft.Office.Interop.Excel.Sheets.get__Default (Object Index) Following is my code snippet private void PasteData(string sSheet) { try { /* Open the corresponding sheet in the WorkSheet */ xlSheetScript = (Excel.Worksheet)xlBookScript.Worksheets[sSheet]; /* Find the last row in that sheet */ for (iCount = 400; iCount 0; iCount--) { xlRange = (Excel.Range)xlSheetScript.Cells[iCount, 2]; if (xlRange.Value2 != null) { break; } } Any help will be greatly appreciated. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
unable to view all open excel worksheet from window | Excel Discussion (Misc queries) | |||
workbook_open not being called when I open the excel file | Excel Programming | |||
When I open a workbook, another one called Book1 is also opened. W | Excel Discussion (Misc queries) | |||
function called from worksheet and bad result! | Excel Programming | |||
Unable to get the NormDist of the Worksheet Function | Excel Programming |