EXCEL automation ACCESS VIOLATION vb

  • Thread starter Thread starter Philippe PERON
  • Start date Start date
P

Philippe PERON

Hello,

the following lines of code work on a WIN XP / EXCEL 2002 machine but
not on a WIN2K / EXCEL 2000 one. I get an ACCESS VIOLATION error and
an "error log is being created" by Dr. WATSON ... all this on a
Workbooks.Open statement ...

ExcelFilePath value is C:\TMP\Equipment_List.xls
 
Hi Philippe

Does your project have a reference to Excel 2002 ? Excel10.olb ? That
library will not exist on an Excel9-only machine. However, Excel8.olb and
Excel9.olb should in theory be upwards compatible and work on a 10-machine.

You could also use late binding, with reference removed:

Dim oApp As Object ' late binding
Dim oDoc As Object ' late binding
On Error Resume Next ' ignore errors
Set oApp = GetObject(, "Excel.Application")
' reference an existing application instance
If oApp Is Nothing Then ' no existing application is running
Set oApp = CreateObject("Excel.Application")
' create a new application instance
End If

detail at Mr Erlandsen's page
http://www.erlandsendata.no/english/index.php?d=envbaoleolebasics
 
Back
Top