Detect if code is running

I have made a code (hosted in an excel workbook) that every 10 min.check a folder for new files.It is essential that this code is always running (at least duringworkday).Any thoughts on how to monitor the code is running, and give an alertif not?

Share:

5 Answers Found

I wouldn't use excel for this because it ties up Excel,and it eats up CPU cycles.

Instead, I would write a VBScript and set it upas a scheduled task to run every 10 minutes.You can even have it only run during certain time of day.Also, you can even write to a log file every time it runsso that you can check the log at any time.

I understand your point.I have never written a VBScript, so I have to look at that, but Ihave a clue, that its close to vba?My code is as mentioned checking for new files (.csv) in a folder, iffound reads the file (testdata) into an array and distribute thedatas to an access database.Is that doable from the VBScript? Maybe a silly question but I knownothing about it!

It is close to VBA but the biggest thing to note is that there is nohost application, so if you want to work with an Office application, youhave to connect explicitly to it, there is no implicit Application.

You should also note that variables are not typed at declaration, theyare all variants, so just do something like

Nothing much to learn from here.Just used the Application.Wait method (check out the help for that)."it ties up Excel, and it eats up CPU cycles". At least theexcel session from where it is running is occupied.