How to find the trigger for a Macro

paultje_bos

New Member
Joined
Oct 20, 2014
Messages
39
I have a database (not created by myself), with a lot of queries, tables, forms, etc, but also some Macro's. Most Macro's are triggered by a button or action, but I have one Macro that has no trigger (at least, not that I can find), but it is activated from time to time (it's an auto-archive Macro).

My question is, is there any way I can find where the trigger is? I already when to most forms and buttons, also looked through the VBA to see if there was a procedure written, but nothing. Or can it be that there is written a script which activates this Macro on the background?
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I don't use macros, so some of this is just educated guessing.
If the macro is not a db object visible in the nav pane, it could be an embedded macro. In that case, you'd probably have to examine the property sheet Event tab for each control to find it. I'm not sure if an embedded macro would be visible if the Access option to "always use event procedures" had been set after an embedded macro had been created. Common sense would dictate that it would.

Then again, it may not be a macro at all. If you have any form with a timer event, that event could be checking to see if it's time to archive.
Using vb editor search function, you could search all code for the name of the file or any part of the path being used to create the archive. If code is calling an external command or batch file (.cmd / .bat) the path is probably contained in that file, thus won't be found using a path search, but it is something else to look for in a network folder.

There are many ways that this could be triggered. You might have to take some time to observe and see if there is any action that seems to trigger it, or even just leave the db open for an extended time (assuming this is allowed) and see if it archives on its own. That would indicate a timer event.
 
Last edited:
Upvote 0
Thanks for the input Micron, tried some of your suggestions, and I simulated some actions and finally found out that the Macro is activated when the database is opened, not via the AutoExec, but when you open the database it also opens the Homescreen Form, and in here the Macro is activated via the On Open Event. Very simple, but I was thinking way to difficult. Thanks anyway!
 
Last edited:
Upvote 0
Me to. I should have thought of that one. I've had visible and hidden forms open during db open many times, many of which had code behind them.
 
Upvote 0

Forum statistics

Threads
1,214,661
Messages
6,120,791
Members
448,994
Latest member
rohitsomani

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