View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Philippe PERON Philippe PERON is offline
external usenet poster
 
Posts: 2
Default EXCEL automation ACCESS VIOLATION vb

Thank you very much Harald, late binding was the solution.

Philippe.

"Harald Staff" wrote in message ...
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/...baoleolebasics

--
HTH. Best wishes Harald
Followup to newsgroup only please

"Philippe PERON" skrev i melding
m...
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

-------------------------------------
Dim exApp As Excel.Application

Set exApp = New Excel.Application
exApp.Workbooks.Open ExcelFilePath
-------------------------------------


Thx,
Philippe.