View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Why doesn't status bar update consistently?

PS - forgot to add - don't think any VBA time related function returns a
greater degree of precision than 1 second.

Peter T

"Peter T" <peter_t@discussions wrote in message
...
Are you saying the debug results are not consistent with how you see the
statusbar change - if so I'd be perplexed!

New API's are sometimes introduced with new Windows OS, and calling in a
Windows OS that does not support the API will invoke nasty problems that
cannot be trapped with an error handler. However Gettickcount has been
around at least since W95. API's don't work in Mac. Do you know of any
limitations with Unix?

Rollovers, if T1 T2 then !!

Regards
Peter T

"

wrote
in message ...
"Peter T" wrote:
As I suggested before, why not try a debug line in your
code to verify the timer loop functions as expected, eg
debug.? application.statusbar


Good idea! I misunderstood your previous suggestion.

The debug.print output shows that application.statusbar
changes as intended every interval, even when the status
bar updates "stall".

Your problem might be related to use of the Timer
function which returns whole seconds since midnight.


Yes, I discovered that later. I was following a Walkenbach
example for measuring time intervals. Nonetheless, I was
not executing across midnight, and I believe my system clock
was valid during all executions, if those are the potential
problems you are alluding to. If not, please elaborate.

Also, I failed to mention that the "done" message always
showed the expected "n" for the interval size, even when
the status bar updates "stalled". So I was "sure" that Timer
returned the correct values (increasing time) -- a fact that I
can now prove with your debug.print suggestion.

Aside: On my system (XP Pro 2002 SP2 with Excel/Office
2003), Timer is a "single" with apparently millisecond
resolution, not "whole seconds". Of course, no telling how
often that time measurement is updated. On Unix systems,
gettimeofday() claims to show microsecond resolution, but
the "softclock" is usually updated only every 10 msec on
some Unix systems.

Might be better to use an API, eg Gettickcount


Good idea. I recall that I stumbled across something like
this somewhere -- as well as a variable, I think. I thought
it was a VBA thing. But, sigh, I cannot remember the exact
names, and I cannot find anything like this now in VBE Help.
In fact, I might have stumbled across them during a google
search, and they might simply have been someone's
implementation around the gettickcount API. I wish I had
paid closer attention.

I would prefer not to use an API, if there is a VBA equivalent.
I suspect there is greater potential for compatibility problems
-- albeit not likely for gettickcount() per se. So if anyone
knows a VBA equivalent, I would appreciate hearing about it.

In the meantime, thanks for the pointer to gettickcount().
I just have to be sure that Windows does not run for more
than 24 days in order to avoid rollover problems :-).