Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VERY tricky timer question

Hi everyone,

I've spent a VERY long time sleuthing the web trying to find a count down
timer system (preferably that prints in the status bar of the workbook, which
i already have a working counting timer i made that does this using the
OnTime method), that allows the user to continue
changing/copying/pasting/etc. whilst it counts down to zero from a predefined
value. Although my own code uses it, you can not use the OnTime method for
this since the timer stops counting down while a user types something into a
cell for example and takes more than a second to do so:

I have found a link of someone that has cracked this problem, using an add-in:
http://www.tushar-mehta.com/excel/so...countdown.html

can this be accomplished without an addin? is it possible to view the source
code of an add-in?

Thankyou for all of your help (in advance)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default VERY tricky timer question

The "tricky" part was deciphering your question, but have a go with this

Option Explicit
Dim mdtStop As Date
Dim mdtInterval As Date
Dim mdtNext As Date

Sub StartTimer()

mdtStop = Now + TimeSerial(0, 0, 30)
mdtNext = Now
mdtInterval = TimeSerial(0, 0, 3)

Application.OnTime mdtStop, "CleanUp"
NextOnTime

End Sub

Sub NextOnTime()
Dim bStop As Boolean

bStop = mdtNext mdtStop
Application.OnTime mdtNext, "Update", bStop

If bStop Then Debug.Print Now
End Sub

Sub Update()
Dim mdtRemaining As Date
Application.StatusBar = CStr(CDate(Now - mdtStop))

mdtNext = Now + mdtInterval

NextOnTime
End Sub

Sub CleanUp()
mdtNext = 0
mdtStop = 0
Application.StatusBar = False
End Sub

Re your question about viewing the source code of an addin: if the project
is locked for viewing with a password the author does not wish you to see
the code and you should respect that.

Regards,
Peter T

"Ryan Ragno" wrote in message
...
Hi everyone,

I've spent a VERY long time sleuthing the web trying to find a count down
timer system (preferably that prints in the status bar of the workbook,

which
i already have a working counting timer i made that does this using the
OnTime method), that allows the user to continue
changing/copying/pasting/etc. whilst it counts down to zero from a

predefined
value. Although my own code uses it, you can not use the OnTime method for
this since the timer stops counting down while a user types something into

a
cell for example and takes more than a second to do so:

I have found a link of someone that has cracked this problem, using an

add-in:
http://www.tushar-mehta.com/excel/so...countdown.html

can this be accomplished without an addin? is it possible to view the

source
code of an add-in?

Thankyou for all of your help (in advance)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default VERY tricky timer question

I have some code at http://xldynamic.com/source/xld.XtraTime.html that you
could adapt.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Ryan Ragno" wrote in message
...
Hi everyone,

I've spent a VERY long time sleuthing the web trying to find a count down
timer system (preferably that prints in the status bar of the workbook,
which
i already have a working counting timer i made that does this using the
OnTime method), that allows the user to continue
changing/copying/pasting/etc. whilst it counts down to zero from a
predefined
value. Although my own code uses it, you can not use the OnTime method for
this since the timer stops counting down while a user types something into
a
cell for example and takes more than a second to do so:

I have found a link of someone that has cracked this problem, using an
add-in:
http://www.tushar-mehta.com/excel/so...countdown.html

can this be accomplished without an addin? is it possible to view the
source
code of an add-in?

Thankyou for all of your help (in advance)



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default VERY tricky timer question

Ryan,

Unfortunately, there is no good way to create a countdown timer that
displays in a worksheet cell. Using only native Excel/VBA, OnTime is the
only way to go. As you have seen, OnTime events are either postponed or
never executed (depending on the LatestTime parameter) if the user is doing
anything within a cell. If you expand your horizons to include the Windows
API, you can use native Windows timers, which have a millisecond resolution
in contrast with OnTime's one second resolution. Be warned, though, that if
the TimerProc callback function called by a Windows timer attempts to modify
any cell while the user is in Edit Mode, you will likely crash Excel and
loose any unsaved work. Both the OnTime method and Windows Timer API
functions are described at www.cpearson.com/Excel/OnTime.aspx.

is it possible to view the source code of an add-in?


If the add-in is an XLA add-in, it is protected only by VBA's *very* weak
protection. Google on "vba password" and you'll likely find ways and
freeware/shareware that can break a VBA password. If the add-in is a COM
add-in, no source code exists within the add-in.


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

"Ryan Ragno" wrote in message
...
Hi everyone,

I've spent a VERY long time sleuthing the web trying to find a count down
timer system (preferably that prints in the status bar of the workbook,
which
i already have a working counting timer i made that does this using the
OnTime method), that allows the user to continue
changing/copying/pasting/etc. whilst it counts down to zero from a
predefined
value. Although my own code uses it, you can not use the OnTime method for
this since the timer stops counting down while a user types something into
a
cell for example and takes more than a second to do so:

I have found a link of someone that has cracked this problem, using an
add-in:
http://www.tushar-mehta.com/excel/so...countdown.html

can this be accomplished without an addin? is it possible to view the
source
code of an add-in?

Thankyou for all of your help (in advance)


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
A tricky format question Digital2k Excel Programming 9 July 28th 06 08:04 AM
Tricky counting question Jay Weiss Excel Discussion (Misc queries) 2 May 1st 06 04:53 PM
New guy with a tricky question Arian Goodwin Excel Programming 3 November 10th 05 03:45 PM
Tricky Question The Boondock Saint Excel Worksheet Functions 7 December 8th 04 07:22 PM
rota question - very tricky... Michelle Tucker Excel Discussion (Misc queries) 0 November 27th 04 11:55 AM


All times are GMT +1. The time now is 02:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"