Run Access Macro Automatically

UnysonElliot

New Member
Joined
Jul 21, 2014
Messages
31
Hello,

I have created a database that I would like to put on a schedule to send out every day without manual intervention. I have seen a lot of posts from various websites about using Windows Task Scheduler. I cannot figure out how to use the Windows Task Scheduler. I was coming here either for help with setting up Windows Task Scheduler to run this macro or if there are any other solutions that anybody knows.

Let me know if you need any info from me that I can provide to help.
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Do you have a macro in the databas that sends it out?

If you do you could set things up so the macro is automatically run when the database is opened and then create a task to open the database at a specific time.
 
Upvote 0
Windows Scheduler can be involved. The way I usually do it is of open an Access database that runs automatically upon opening.
You can set an Access database to run automatically upon opening in one of two ways:
- Create a macro and name it "AutoExec". Any macro with this name will run automatically upon opening.
- Designate a form to be a Startup Form. Then, put VBA code in the Load event of this form. Thus, the VBA code will run automatically whenever the database is opened.
 
Upvote 0
Windows Scheduler can be involved. The way I usually do it is of open an Access database that runs automatically upon opening.
You can set an Access database to run automatically upon opening in one of two ways:
- Create a macro and name it "AutoExec". Any macro with this name will run automatically upon opening.
- Designate a form to be a Startup Form. Then, put VBA code in the Load event of this form. Thus, the VBA code will run automatically whenever the database is opened.

So I already have a form with a button on it running the Macro. Your solution does solve the part of clicking the button. I'd rather not have to open the access database at all. I didn't know if there was code I could add to the module that I already have to make it kick off at a certain time each day. The module I have already exports my file to a location with the current date on it.
 
Upvote 0
Where is the 'module' that exports the file located?
 
Last edited:
Upvote 0
You can't run code that's in a database without opening the database.

What exactly does the code do?
 
Upvote 0
You can't run code that's in a database without opening the database.

What exactly does the code do?

It exports a query with a dynamic title to a certain tab in an Excel file. I have two of these exporting 2 queries. The reason I had to use a module was to get the dynamic title which contains the current date so it will not override each report.
 
Upvote 0
Have you considered using code in the Excel workbook to import from the database?

That code could be set to run when the workbook opens, and only to run if there isn't an existing tab for the current date.
 
Upvote 0

Forum statistics

Threads
1,223,910
Messages
6,175,316
Members
452,634
Latest member
cpostell

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