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

  • Thread starter Thread starter KBraun228
  • Start date Start date
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.
 
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]...
 
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]...
 
Back
Top