"Ajay" <sanee...@gmail.com> said this in news item
news:d58c5bcc-3947-4713...@y10g2000prg.googlegroups.com...
Your problem is that you use the SendKeys method. Not only will it fail when
the machine is locked but it is also inherently fragile because it gets
tripped up by lots of things such as unexpected pop-up boxes, virus scanner
updates, Windows automatic updates, tasks taking much longer than
anticipated (e.g. because of some resource-heavy background activity). To
make your application robust you should use methods other than SendKeys. As
a fringe benefit you will then solve your current problem. There is a
further fringe benefit: Your Excel stuff will run much faster.
hi Sanseen,
The script is running under the scheduler, and your pc
is locked due to inactivity, so I am guessing that you
are not around.
If you are not around but expecting to use sendkeys,
then the answers to the dialogs must already be built
into your script.
If you can change the XL macro code, then you could
write your info/data into a temporary file, and then
have the XL macro read the file rather than use a
dialog to get the info/data. Or an even more direct
solution would be to enter your data into an unused
area of the worksheet and have the macro pick it up
from there (and then clear those cells when you are
done).
If you can _not_ change the XL macro, then I think you
are SOOL.
Er well, on second thought maybe there is another
possibility. It may be possible to "pipe in" your
input via the "StdIn" mechanism. Take a look at the
"wshScriptExec" object. I have never used it in
conjunction with an XL dialog (or any other dialog),
but it may be worth a shot.
cheers, jw