MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

Detect if code is running

  Asked By: Alonsa    Date: Feb 01    Category: MS Office    Views: 1841

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 during
Any thoughts on how to monitor the code is running, and give an alert
if not?



5 Answers Found

Answer #1    Answered By: Spiru Kelly     Answered On: Feb 01

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 up
as 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 runs
so that you can check the log at any time.

Answer #2    Answered By: Jenny Lopez     Answered On: Feb 01

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

Answer #3    Answered By: Aiko Suzuki     Answered On: Feb 01

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

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

Dim myNum
Dim myString


Answer #4    Answered By: Ellen Simpson     Answered On: Feb 01

I am very interested about your application on how to use timer in
Excel application.
Could you give me some examples for this case? thanks a lot!

Answer #5    Answered By: Patricia Johnson     Answered On: Feb 01

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 the
excel session from where it is running is occupied.

Didn't find what you were looking for? Find more on Detect if code is running Or get search suggestion and latest updates.