Running macros from an external source

respree

Active Member
Joined
Apr 14, 2003
Messages
258
I'm not sure if my subject is phrased properly.

Can I have one macro launch another macro in a different .mdb file?

Or is it possible to have one file launch four different macros in four different files, but wait for the previously launched macro to finish processing?

Here's my situation.

I have four Access files, each with a macro which runs a procedure to import information, process the file(s), then export information.

File1 imports a specified file
File2 import is File1 export
File3 import is File2 export
File4 import is File3 export
(Each import is dependent upon the prevoius file's export)

I'm trying to figure out a way to automate this process. The programs are chewing on 100,000 records, so its taking about 5 minutes for each file to process. I'm trying to avoid sitting a the computer for 20 minutes or going back to my desk 4 times to wait for the previous file to complete its processing.

Do I need some kind of VB program or can this be done through the macro itself (whereby the ending command is to launch the macro in the next file).

If VB is required, can you provide the code assuming?

macroname, file1.mdb
macroname, file2,mdb
macroname, file3.mdb
macroname, file4.mdb

I would appreciate any suggestions.
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hullo. What you want to do is possible. I've a question first, though: Why are these macros in seperate dbs? Is there a business reason why they cannot all reside in the same db? Your problem would be simplicity itself then.

Now, assuming that there is a valid reason for them to be in different files, one possible solution would be to create a "collection" db, and import all the macros to the "collection," and run them in sequence from there with a "master caller" macro.

On the other hand, there is a way to do this via VBA, but, it may not be necessary to go that route.

HTH

P
 
Upvote 0
Thanks for your response, P.

In hindsight, I would have built all four files into one, which, of course, would solve this problem.

This is my first venture into Access, and the applications I've built are fairly complex, so for my own sanity, it helped to keep each of the major functions the database was performing (calculating) in separate files (for organization purposes).

That said, I have a question about your suggestion.

I'm not sure if I'm understanding you, because its seems like I'm missing a step. As a test, I have successfully imported the first macro from the first file into a newly created file we'll call "mastermacro.mdb". However, none of the queries that this macro runs are contained in the newly created "mastermacro" file because the related queries were not imported. I feel like I'm missing something obvious, but don't know what.

Could you please so kind as to clarify? Thank you.
 
Upvote 0

Forum statistics

Threads
1,223,532
Messages
6,172,879
Members
452,486
Latest member
standw01

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