|
-
Aug 4th, 2011, 01:17 PM
#1
Thread Starter
Member
VB.Net 2010 program .exe wants Excel 2010
VB.Net 2010 program .exe on PC with Excel 2007 gives error when cannot
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=14.0.0.0, 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:
Code:
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)
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|