Using Excel from Access

D

DZ

I want to use Automation to obtain properties from an Excel 97 workbook from
another Office App

Here is some code I tried. I need help getting it to work. When I run it, I
get an error message

"Run-time error '-2147417851 (80010105)' Method 'Open' of object
'Workbooks' failed"

The code is in an Access 97 form . OS Win XP
In the current database i have set a references to
Microsoft Excel 8.0 Objct Library
Microsoft Officel 8.0 Objct Library

I am able create a new instance of the Excel Application
But any manipulation of the App generates an error

The following code works, and I am able to create a new instance of Excel
I know this because I can observe Excel.Exe opening in the Windows Task
Manager

....but when attempt to use any of the commented out code to manipulate
Excel, the error mentioned above occurs

'Declaration section
Option Explicit
Dim xlApp As New Excel.application
Dim xlwbBook As New Excel.Workbook

Sub OpenExcelAndManipulate()

Dim stFile As String
stFile = "E:\New Files\Data.xls"

Set xlApp = New Excel.application
'xlApp.Visible = True

'Set xlwbBook = xlApp.Workbooks.Open(stFile)


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top