find Excel version 14, which is Excel 2010
I have developed a program in VB.Net 2010 which reads from an Excel
spreadsheet. It works fine in the IDE on my computer. I built an
.msi and executed it on my computer. I get "Error: 53 - Could not
load file or assembly 'Microsoft.Office.Interop.Excel,
Version=184.108.40.206, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or
one of its dependencies. The system cannot find the file specified."
The only version of Excel on my computer is 2007, which is version
12.0.6557.5000. The version the error says it needs, version 14, is
actually the version of Excel 2010.
I have put in MsgBox statements to find where the error occurs.
These lines are in the .vb file:
Imports System.Console Imports System.IO Imports Microsoft.VisualBasic Imports System.Data Imports System.Windows.Forms Imports System.Windows.Forms.Button Imports System.Windows.Forms.CheckBox Imports Microsoft.Office.Interop The error occurs when a routine is called which has the following statements: Dim xlApp As Excel.Application Dim xlWorkBook As Excel.Workbook Dim xlWorkSheet As Excel.Worksheet These statements are also in the file: xlApp = New Excel.ApplicationClass xlWorkBook = xlApp.Workbooks.Open(sDatabaseNames(iThisDatabase), , True) sWorkbookName = sDatabaseNames(iThisDatabase) For iCurrentWorksheet = 1 To xlWorkBook.Worksheets.Count xlWorkSheet = xlWorkBook.Worksheets(iCurrentWorksheet) sWorksheetName = xlWorkSheet.Name range = xlWorkSheet.UsedRange rngSearchRange = range.Find(What:=sSearchPhrase)