The code I'm using is:
private void OpenExcelFile() { Excel.Application exlApp = new Microsoft.Office.Interop.Excel.Application(); if (exlApp == null) { MessageBox.Show("Excel app object could not be created"); } else { exlFileSelector.FileName = @"*.xls"; if (exlFileSelector.ShowDialog() == DialogResult.OK) { Excel.Workbook wrkBook = exlApp.Workbooks.Open(exlFileSelector.FileName, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, true, true); Excel.Sheets sheetList = wrkBook.Sheets; Excel.Range search = exlApp.get_Range("A1", "C5"); search.Find("FindMe", null, Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlWhole, Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, false, null, null); } } }
This is the answer to which "codex" answered the previous question asked in this forum. But when I copy it to my application, the system does not recognize exlFileSelector.FileName . How can i fix this? What am I missing? I tried for some time to do a simple search in an Excel file, but no luck. (I added the Excel link needed for the project). Thank you
source share