Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Error: DISP_E_TYPEMISMATCH while interop.excel

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_objBo oks.get_Item(1));
m_objSheets = (Microsoft.Office.Interop.Excel.Sheets)m_objBook.W orksheets;

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Error: DISP_E_TYPEMISMATCH while interop.excel

On Jul 7, 12:04*am, SuneelP wrote:
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_objBo oks.get_Item(1));
m_objSheets = (Microsoft.Office.Interop.Excel.Sheets)m_objBook.W orksheets;

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


Which line throws the exception?
I don't know if it works for you, but if you have small workbooks you
can use our GemBox.Spreadsheet Free (http://www.gemboxsoftware.com/
GBSpreadsheetFree.htm) Excel component for XLS/CSV/XLSX reading/
writing/reporting.
Automation causes many problems: http://www.gemboxsoftware.com/GBSpre...htm#Automation

--Zeljko
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Interop Excel thejamie Excel Programming 2 March 24th 08 11:41 AM
Interop Chart Series Error Oliver Excel Programming 1 May 2nd 07 06:56 PM
Excel interop from c# Velislav Excel Programming 3 February 15th 07 07:39 AM
Microsoft.Office.Interop.Excel SaveAs error when clicking no or ca NeedsExcelAssistance Excel Programming 0 July 14th 06 02:50 PM
Excel interop versions Maik Excel Programming 2 May 16th 05 09:32 PM


All times are GMT +1. The time now is 03:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"