VB Workbooks.Add method will not work from my MS Access 2007.

K

KBraun228

A semblence of this code worked in my MS Access 2003 application. Since
upgrading to 2007, NO attempt at opening an Excel file from within Access is
working for me.

Dim appExcel As Excel.Application
Dim wbk As Excel.Workbook
Dim wks As Excel.Worksheet

Set appExcel = Excel.Application
Set wbk = appExcel.Workbooks.Open ""C:\0-Data\test.xlsx"
Set wks = appExcel.Worksheets(cTabOne)
appExcel.Visible = True

Even this short snippet errors if from my Access application, it does work
if I attach it to a command button in Excel:

Workbooks.Add

I've tried making every Trust Center setting as open as possible, in Access
and Excel and still I receive an error.
 
G

GeoffG

Have you set a reference to Excel?

In the VBA editor: Tools > References > Microsoft Excel
[Version #] Object Library.

What error message to you get?


Geoff


message
news:[email protected]...
 
G

GeoffG

Have you set a reference to Excel?

In the VBA editor: Tools > References > Microsoft Excel
[Version #] Object Library.

What error message to you get?


Geoff


message
news:[email protected]...
 

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