Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Automation to Excel from Access | Excel Discussion (Misc queries) | |||
Excel 97 Access Violation! | Excel Discussion (Misc queries) | |||
Running Access-to-Excel Automation.... | Excel Discussion (Misc queries) | |||
automation from access into excel | Excel Discussion (Misc queries) | |||
Automation Excel & Access | Excel Programming |