Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Macro to run multiple macros

6 views
Skip to first unread message

Martin

unread,
Dec 29, 2006, 1:58:00 PM12/29/06
to
Is it possible to create a macro in Access 2003 that will run macros from
different Access Applications?

Example: Access Apps: A, B, C
Macros: 1,2 from A; 3 from B; 4,5,6 from C

So can a macro be written that calls 1,2,3,4,5,6?

Thank you.

Wayne-I-M

unread,
Dec 29, 2006, 2:06:00 PM12/29/06
to
Hi Martin

Are you looking for shell to call a macro in another database. Sorry but I
don't understand


--
Wayne
Manchester, England.

Martin

unread,
Dec 29, 2006, 2:15:00 PM12/29/06
to
At this point I am looking to see if I create a new Access Application and
have a macro within this new application run macros in other Access
applications. Currently, the setup I am working with has multiple
applications and I am trying to see if I can consolidate it within Access. I
have a feeling that this may not be able to be done through Access, but
through VB.

Wayne-I-M

unread,
Dec 29, 2006, 2:29:01 PM12/29/06
to
Hi Martin

1st create your new DB and place some "bits" on it form, table, etc. Then
create a macro in this new DB ( call it OpenNewForm)

You can use a number of way to open a DB from another DB but the simplest it
to use a Call Shell function. You need also to (once the other D Base is
open) open the other form, so many people (me included) will do a bit of a
cheat here and
use a macro (in the other D Base) - which is why I suggested making the new
OpenNewForm macro.

In the other (old) DB place a button on a form and place this behind the
OnClick event
Change the "button Name" to what it is 1st though ?


Private Sub Button Name_Click()
On Error GoTo ButtonName_Click_Err
Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
""S:\MyDocuments\MyDataBase.mdb""/XOpenNewForm", 1)
ButtonName_Click_Exit:
Exit Sub
ButtonName _Click_Err:
MsgBox Error$
Resume ButtonName _Click_Exit
End Sub


Martin I am not sure how much you understood the above so sorry if you
already know this but maybe the explanaton will assist another forum member
if you already know this.

Ensure you leave all the """"""""" and ((((())))) and other stuff (just
change the names) where I have put them. For more information on these doa
search in this forum as some new users find them a problem.

To explain

Call Shell("""Location of new D Base"" ""Full path of new
DB""/XMacroName", 1)

To find the location of the D Base (could be C drive or on a server it will
be somewhere else) use the Start - Run - Browse and then look for the
programme (don't click the run option, after you have found it simply
Cut-N-paste it into your code). You can use the same method to find the path
of your MDB.
The macro will need to be stored in the other DataBase and called from the
code in your current (the one with this code) the X simply tell access it's
a macro ie. XMacroName (which why you should never start the name of a
macro with an X.

I have used C drive if you DB is on another drive change this is the shell

Hope this helps

Martin

unread,
Dec 29, 2006, 2:29:01 PM12/29/06
to
There is also an Action named "RunMacro" which can run macros even from
macrogroups but I don't think this Action can work with macros from other
Access Applications.

Wayne-I-M

unread,
Dec 29, 2006, 2:37:00 PM12/29/06
to
Sorry wrong explanation

I am in the office at the moment on a server system

I am working on C drive and calling the macro on the server (S drive)


Call Shell("""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
""S:\MyDocuments\MyDataBase.mdb""/XOpenNewForm", 1)

Notice the C:\ and the S:\


Sorry for that - hope it is clear now


--
Wayne
Manchester, England.


Steve Schapel

unread,
Dec 29, 2006, 2:53:20 PM12/29/06
to
Martin,

You can use a RunApp action in a macro to run a macro in another Access
app. The Command Line argument is along these lines...

"C:\Program Files\Microsoft Office\Msaccess.exe"
"C:\YourFolder\OtherApp.mde" /x MacroName

--
Steve Schapel, Microsoft Access MVP

david@epsomdotcomdotau

unread,
Dec 30, 2006, 2:51:53 AM12/30/06
to
If you are going to run multiple applications, VBA, VBS, VB6 or
VBNet would probably be suitable INSTEAD of macro's. Access
Macro's have no error handling or exception handling ability, so
in Access, applications and shells are normally written in VBA.

VBA has the ability to 'reference' VBA routines in other Access
applications, without loading a separate access application.

Anything you do in a macro can be done exactly the same way
in Access VBA - all of the macro commands are available - and
the data objects you would use in VBS or VB6 are also available
as well.

(david)

"Martin" <Mar...@discussions.microsoft.com> wrote in message
news:80C169B5-FA64-4B11...@microsoft.com...

0 new messages