Automate saved imports by VBA code - setup to run every night

jlyn123

New Member
Joined
Jan 24, 2018
Messages
48
Office Version
  1. 2016
Hello,

Is there a way to have a saved import run each night - a code that this do thise without opening the database?

Thanks!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I usually make a separate Access database that links to this other database (it really just is another version of the "Front End Database"), runs upon opening, executes code, and then automatically close.
You can do that with an AutoExec macro (any macro named "AutoExec" automatically runs upon opening it), or by putting the VBA code in the Load event of a Form, and set that Form to be the Startup Form that the database opens to).
Then you can use any Scheduling program to open the database at the time you want it to run.

So it will open it at your designated time, run the code, and automatically close itself.
I have used this method with great success many times.
 
Upvote 0
Isn't that like asking if Word or Excel can open a file without the application itself being opened? I'd bet my dog's life that it can't be done without opening Access in one way or another. You could use Task Scheduler to open the db at night, but your coding skill would need to be somewhat good and the pc running TS has to be left on. TS has an option to run a task whether or not you are logged in, but if IT/IS reboots the machine during the night, it would be a problem if a network login is lost, I think. When doing this, I used TS to activate a shortcut that contains a command line switch so that the db knows TS is opening the db. My startup code ran one way for TS and another way for a regular user.

Are you sure the import needs to be done on a regular basis instead of linking tables to something?

P.S. I don't own a dog :rolleyes:
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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