Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Running Access Macro from Excel

I've got the following code that I would like to use to open an Access Macro
from excel however I am getting a compile error -"User defined type not
defined":

Sub AccessTest1()
Dim AccApp As Access.Application
Set AccApp = CreateObject("Access.Application")
Set AccApp.OpenCurrentDatabase ("C:\2008MRD.mdb")=
AccApp.DoCmd.RunMacro "Macro2"
AccApp.Quit
End Sub

Any suggestions as to what I should add/change?

Thanks.
--

Bob
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Running Access Macro from Excel

I've not run Access macros from Excel, but I'd bet you need to add a
Reference to Access. In the VBA, try Tools - References - I'd guess it's
Microsoft Access ...

SInce I don't have Access loaded on this machine, I can't give any more
specifics.
--
HTH,
Barb Reinhardt



"Bob" wrote:

I've got the following code that I would like to use to open an Access Macro
from excel however I am getting a compile error -"User defined type not
defined":

Sub AccessTest1()
Dim AccApp As Access.Application
Set AccApp = CreateObject("Access.Application")
Set AccApp.OpenCurrentDatabase ("C:\2008MRD.mdb")=
AccApp.DoCmd.RunMacro "Macro2"
AccApp.Quit
End Sub

Any suggestions as to what I should add/change?

Thanks.
--

Bob

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Running Access Macro from Excel

Try this:

Sub AccessTest1()
Dim AccApp As Object
Set AccApp = CreateObject("Access.Application")
' Just to show you that it's working
AccApp.Visible = True
AccApp.OpenCurrentDatabase ("C:\2008MRD.mdb")
AccApp.DoCmd.RunMacro "Macro2"
AccApp.Quit
End Sub


--
Malik


"Bob" wrote:

I've got the following code that I would like to use to open an Access Macro
from excel however I am getting a compile error -"User defined type not
defined":

Sub AccessTest1()
Dim AccApp As Access.Application
Set AccApp = CreateObject("Access.Application")
Set AccApp.OpenCurrentDatabase ("C:\2008MRD.mdb")=
AccApp.DoCmd.RunMacro "Macro2"
AccApp.Quit
End Sub

Any suggestions as to what I should add/change?

Thanks.
--

Bob

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
Running a macro from Access in excel and then refreshing external data in excel [email protected] Excel Programming 1 August 31st 06 08:25 PM
Getting Access Error Messages when running Access through Excel Dkline[_2_] Excel Programming 0 October 12th 04 09:35 PM
Running A Access Macro From Excel Frank Excel Programming 2 August 12th 04 06:43 AM
"Programmatic Access to be Denied" displays when running macro on excel in XP Stephen Fong Excel Programming 3 October 21st 03 09:19 AM
Launch Macro in Access via Macro running in Excel??? dgrant Excel Programming 1 September 24th 03 01:38 PM


All times are GMT +1. The time now is 07:36 AM.

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"