S
SuneelP
Subject: DISP_E_TYPEMISMATCH interop.excel
Hi:
I need help in read excel sheet from C# using Interop.Excel.Application
(Excel Data Library 10)
and find & replace a word from a range in a sheet.
I have following code which gives an error "DISP_E_TYPEMISMATCH".
===============
m_objExcel = new Microsoft.Office.Interop.Excel.Application();
// open the workbook object by opening the excel file.
m_objBook = m_objExcel.Workbooks.Open(filePath,
0,
false,
5,
"",
"",
true,
XlPlatform.xlWindows,
"\t",
true,
false,
0,
true,
1,
0);
//m_objBook =
(Microsoft.Office.Interop.Excel._Workbook)(m_objBooks.get_Item(1));
m_objSheets = (Microsoft.Office.Interop.Excel.Sheets)m_objBook.Worksheets;
foreach (Microsoft.Office.Interop.Excel._Worksheet m_objSheet in m_objSheets)
{
m_objRange = m_objSheet.Cells; //m_objSheet.get_Range("A1",
"AZ20");
}
====================
Any help would be appreciated. Thanks you in davance.
SuneelP
Hi:
I need help in read excel sheet from C# using Interop.Excel.Application
(Excel Data Library 10)
and find & replace a word from a range in a sheet.
I have following code which gives an error "DISP_E_TYPEMISMATCH".
===============
m_objExcel = new Microsoft.Office.Interop.Excel.Application();
// open the workbook object by opening the excel file.
m_objBook = m_objExcel.Workbooks.Open(filePath,
0,
false,
5,
"",
"",
true,
XlPlatform.xlWindows,
"\t",
true,
false,
0,
true,
1,
0);
//m_objBook =
(Microsoft.Office.Interop.Excel._Workbook)(m_objBooks.get_Item(1));
m_objSheets = (Microsoft.Office.Interop.Excel.Sheets)m_objBook.Worksheets;
foreach (Microsoft.Office.Interop.Excel._Worksheet m_objSheet in m_objSheets)
{
m_objRange = m_objSheet.Cells; //m_objSheet.get_Range("A1",
"AZ20");
}
====================
Any help would be appreciated. Thanks you in davance.
SuneelP