Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default automation excel to access

Look he
http://www.accessmvp.com/KDSnell/EXCEL_MainPage.htm

HTH,
Ryan---
--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"goaljohnbill" wrote:

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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel/Access automation Arly Q. Excel Programming 0 June 7th 07 02:38 PM
automation from access into excel SAm Excel Discussion (Misc queries) 7 January 27th 06 02:49 AM
Excel Automation from Access Sam Tyler[_3_] Excel Programming 1 December 16th 05 08:33 PM
Automation between Access and Excel J. Toews Excel Programming 4 October 12th 04 02:55 PM
Access automation from Excel AccessChallenged Excel Programming 2 December 31st 03 06:29 PM


All times are GMT +1. The time now is 12:10 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"