Call an Access(already running) macro from Word, Office 2013 (1 Viewer)

FAB1

Registered User.
Local time
Today, 10:00
Joined
Jul 27, 2007
Messages
40
Hi All
I have been trying to improve an import routine in our office DB. The issue I am having is calling / triggering a macro in the “already running” office DB from Word. All the examples I have found are all based on opening a new instance of Access.

The already open db is = "C:\Tracker Local\TrackerFE\Tracker_FE.accdb"
macro to run = “mac_InTray”

Can’t find any other code that doesn’t use the Application.OpenCurrentDatabase Method

Help?
Office2013
 

spikepl

Eledittingent Beliped
Local time
Today, 11:00
Joined
Nov 3, 2010
Messages
6,142
set appAccess=GetObject(fulldatabasepath)

and you can run a function by

result = appAccess.Run("NameOfMyFunction", someParameter)


how to run a macro i dunno, probably something similar
 

vbaInet

AWF VIP
Local time
Today, 10:00
Joined
Jan 22, 2010
Messages
26,374
how to run a macro i dunno, probably something similar
appAccess.DoCmd.RunMacro

However, I would do it the function way like spikepl explained. Convert your macro to a Public function. There's a button that can do the conversion for you.
 

FAB1

Registered User.
Local time
Today, 10:00
Joined
Jul 27, 2007
Messages
40
Thanks guys just the push i needed:)
Cheers
FAB1

Code:
Sub StartAccess_Import_Macro()
   
  Dim appAccess As Access.Application
  Set appAccess = GetObject("C:\Tracker Local\TrackerFE\Tracker_FE.accdb")
        appAccess.DoCmd.RunMacro "mac_InTray"
  Application.Quit
   
  End Sub
 

Users who are viewing this thread

Top Bottom