Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am working to make an aplication that open an existing excel file, search for some text and notifies the result. Now, when I run it, before the excel file's opens get this error: COMException Types mismatch (Exception HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)) My code is: object oMissing = System.Reflection.Missing.Value; Excel.ApplicationClass oExcel = new Excel.ApplicationClass(); oExcel.Visible = true; Excel.Workbooks oBooks = oExcel.Workbooks; Excel._Workbook oBook = null; oBook = oBooks.Open(path, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing); Object cad = Cadena.Text; Object LookIn = "xlValues"; Object LookAt = "xlWhole"; Microsoft.Office.Interop.Excel.XlSearchDirection xlApp = new Microsoft.Office.Interop.Excel.XlSearchDirection() ; Object resultat = oBook.Sheets.Application.Cells.Find(cad, oMissing, LookIn, LookAt, oMissing, xlApp, oMissing, oMissing, oMissing).Activate(); // Quit Excel and clean up. oBook.Close(false, oMissing, oMissing); System.Runtime.InteropServices.Marshal.ReleaseComO bject(oBook); oBook = null; System.Runtime.InteropServices.Marshal.ReleaseComO bject(oBooks); oBooks = null; oExcel.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComO bject(oExcel); oExcel = null; Another problem I probably will have is to run the find function for all sheets. thanks for advanced. Marc |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to write code for find a word in excel? | Excel Programming | |||
How do I find a code in Excel | Excel Worksheet Functions | |||
Excel VBA code for find/replace | Excel Programming | |||
Find the cell value in excel by using vb code | Excel Discussion (Misc queries) | |||
How to find the version of Excel in code | Excel Programming |