View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Timer sticking in XP

This gives two examples of doing it with the windows API. The first is
simple - uses sleep. The second is more complex. The article explains why
you might prefer the second, but if screen updating isn't an issue in that
second, the first seems workable to me.

http://support.microsoft.com/?id=231298
HOWTO: Use SetWaitableTimer With Visual Basic


A post by Chip Pearson:
http://groups.google.com/groups?thre...GP09.ph x.gbl

I couldn't find anything that said there is a problem with Wait in xl2002,
but I could have missed it.

Regards,
Tom Ogilvy


"Ronald Dodge" wrote in message
...
I have a series of macros that updates information from Excel to our main

DB
program. Main 2 reasons why the operators are not using the interface

that
has been provided for us to update directly into our main DB program, it's
not user friendly cause of the various things that the operators has to do
including either have to calculate how much time they spent at the machine
center for each step or put in both start and ending times in text format,
and it's too easy for them to fudge the numbers for those that does know

how
to use the system.

I created a program that acts as the main interface for the users and they
only see the main screen and then a pop up wondow for a few other minor
things from the main screen. Granted, the numbers can be fudged to some
degree, but not near as easily with my interface as it can be with the

DB's
interface. Given the sharing issues of Excel, I had to create a separate
file for each machine center, which then I created a main file that pulls
the information from each individual machine center file, then updates our
main DB system via the interface. This program that I created was only
meant as a temporary solution as I am working on a more permanent type
solution. At the time that I created the program, I only had 3 weeks to

do
it in and have it tested.

Issues that I had to address for updating our main DB system:

Can only use the SendKey method to update the system (I hate to do it this
way, but don't have a choice)
Had to slow down the system between each field entry, update, and screen
change to allow the DB's interface to catch up (see code below).

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 1
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
SendKeys "+{F10}", True

This worked fine in Excel 97, but we have recently upgraded to Excel XP
(2002) and it is now getting stuck on the Application.Wait waitTime line.

I
had gotten this code directly from Excel VBA's help file. I have done all
of the updates and patches to Office XP as of 8/25/2003.

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000