Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default EXCEL automation ACCESS VIOLATION vb

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default EXCEL automation ACCESS VIOLATION vb

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.



  #3   Report Post  
Posted to microsoft.public.excel.programming
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Automation to Excel from Access Bob Barnes Excel Discussion (Misc queries) 1 February 11th 08 05:18 AM
Excel 97 Access Violation! patrickmuldoon9 Excel Discussion (Misc queries) 0 June 27th 06 12:24 PM
Running Access-to-Excel Automation.... Bob Barnes Excel Discussion (Misc queries) 2 June 16th 06 08:57 PM
automation from access into excel SAm Excel Discussion (Misc queries) 7 January 27th 06 02:49 AM
Automation Excel & Access GarethG Excel Programming 6 October 3rd 03 09:14 AM


All times are GMT +1. The time now is 03:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"