View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
goaljohnbill goaljohnbill is offline
external usenet poster
 
Posts: 18
Default automation excel to access

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