Run Access Macros in Excel

bobdole22

New Member
Joined
Aug 28, 2013
Messages
4
I am trying to run this code, I got from another thread on this forum that is closed. I'm sure it's been used a ton of times. It is supposed to link to an Access file and run it's macro.I have 2007, so my db files are ".accdb" if that changes anything. Here is the code:

VB:

Dim strDatabasePath As String Dim appAccess As Access.Application strDatabasePath = "C:\Users\zachk\Desktop\Strats 2011.01.accdb" Set appAccess = New Access.Application With appAccess Application.DisplayAlerts = False .OpenCurrentDatabase strDatabasePath .DoCmd.RunMacro "qry_MakeTrustTable_Adhoc" .Quit End With Set appAccess = Nothing </pre>

I am getting the error
User-defined Type not defined

on line:

Set appAccess = New Access.Application
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Actually, it only does that the second time I run it. The first time it simply reports a Blank MessageBox " ". Doesn't have any info whatsoever. Is it possible I'm getting a warning because we usually runs it with warnings off in Access? Is that possible in Excel.

Also, even stranger is that I have a MsgBox "Finished" at the end of the sub that doesn't get run. This makes me think that the code doesn't go all the way though.
 
Upvote 0

Forum statistics

Threads
1,216,083
Messages
6,128,718
Members
449,465
Latest member
TAKLAM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top