Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 07-17-2015, 02:02 AM   #1
FAB1
Newly Registered User
 
Join Date: Jul 2007
Posts: 33
Thanks: 5
Thanked 0 Times in 0 Posts
FAB1 is on a distinguished road
Call an Access(already running) macro from Word, Office 2013

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

FAB1 is offline   Reply With Quote
Old 07-17-2015, 05:07 AM   #2
spikepl
Eledittingent Beliped
 
spikepl's Avatar
 
Join Date: Nov 2010
Location: San Serriffe
Posts: 6,144
Thanks: 77
Thanked 980 Times in 958 Posts
spikepl is a jewel in the rough spikepl is a jewel in the rough spikepl is a jewel in the rough
Re: Call an Access(already running) macro from Word, Office 2013

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
__________________

Don't tell us what did not happen.
Do you tell the mechanic about your car "it doesn't work" or vague stuff like:
I couldn't, No joy, To no avail, No go
, Incorrect, Wrong, Seems, Without success, It didn't let me, I/it failed.

Do tell us what did happen
:

I want this ... to happen, I attempted this ..., using this ... code and pressing these buttons, the system did this ... in response, and I got this ... error in this ... line.

Did it help? Pass it forward!

Joys of Access:
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

spikepl is offline   Reply With Quote
The Following User Says Thank You to spikepl For This Useful Post:
FAB1 (07-17-2015)
Old 07-17-2015, 06:25 AM   #3
vbaInet
AWF VIP
 
Join Date: Jan 2010
Location: U.K.
Posts: 26,374
Thanks: 0
Thanked 2,423 Times in 2,389 Posts
vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all vbaInet is a name known to all
Re: Call an Access(already running) macro from Word, Office 2013

Quote:
Originally Posted by spikepl View Post
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.

vbaInet is offline   Reply With Quote
The Following User Says Thank You to vbaInet For This Useful Post:
FAB1 (07-17-2015)
Old 07-17-2015, 07:25 AM   #4
FAB1
Newly Registered User
 
Join Date: Jul 2007
Posts: 33
Thanks: 5
Thanked 0 Times in 0 Posts
FAB1 is on a distinguished road
Re: Call an Access(already running) macro from Word, Office 2013

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

FAB1 is offline   Reply With Quote
Reply

Tags
access , macro , vba , word

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Access 2013 hybrid app linking to office 365 sharepoint Techworks Access Web 8 06-23-2014 12:09 AM
Office 365 Home Premium (Access) Vs the MS Office 2013 disk Mike375 General 3 02-27-2014 09:47 AM
MS Office 2013... no mention of new Access capabilities mdlueck General 2 01-29-2013 10:37 AM
Word Macro - Running one from Access? meandmyhorse Modules & VBA 9 10-24-2012 12:19 PM
Running A Word Macro From Access Command Button Ploho Modules & VBA 6 09-04-2009 07:11 AM




All times are GMT -8. The time now is 05:35 AM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World