automation excel to access

G

goaljohnbill

I am exploring automation for excel and access using the following
code just to see how it works.

In access;

Dim appExcel As Excel.Application, appMacroWB As Excel.Workbook
Set appExcel = GetObject(, "Excel.Application")
appExcel.Visible = True

Set appMacroWB = appExcel.Workbooks.Open _
("T:\Groups\PAM\Meat Juice Lab\tdevelopment\Excel dev\Code
dictionary.xls")
appExcel.Run "'Code dictionary.xls'!test2cd"
Set apExcel = Nothing

In excel;

sub test2cd
MsgBox ("you have ran this macro from access")
Dim apAccess As Access.Application
Set apAccess = GetObject(, "Access.Application")
apAccess.Visible = True

apAccess.DoCmd.RunMacro "a_FromExcelMsgBox", , ""
Set apAccess = Nothing

end sub

The a_FromExcelMsgBox macro is just a msgbox to show me that it went
"back" to access

My problem is with the apAccess.Visible = True line I get the
following error:

run time error 2455
you have entered an expression that has an invalid reference to the
property visible

If I take that line out it leaves me in excel with a msgbox up in
access

I was wondering why it works for excel and not for access (btw i have
access 9 and xl 10)


thanks in advance
 

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