Results 1 to 11 of 11
  1. #1
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,826
    Thanks
    136
    Thanked 482 Times in 459 Posts

    Excel Digital Clock

    Hi All

    I was trying to work out a simple way for User's to enter a time value, and got distracted with making a digital clock in Excel2010 (see attached .xlsm file).

    And then when I got the digital clock running, I couldn't do anything else in Excel.
    So I continued adapting it until, now, I can do other stuff in Excel and still have the clock running.
    Of course, while I edit a cell or take a long time to press [Enter], the clock pauses till I'm done, but then it catches up with the right time.
    Also, if the clock is running and I want to edit/add any vba code, I have to turn the clock off to do that.
    So I added ON and OFF buttons.

    So now I have a nice digital clock.
    It works very smoothly in my Excel2007, Excel2010 and Excel2013.
    (It flashes annoyingly a bit when I saved it as an Excel2003 version).

    So I give you..
    ..the Excel zeddy-digital-clock. It's only 46Kb!

    If only I knew what I was going to do with it.
    Please let me know if you have any ideas.

    zeddy
    Attached Files Attached Files

  2. The Following User Says Thank You to zeddy For This Useful Post:

    RetiredGeek (2013-08-09)

  3. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Zeddy,

    Interesting behavior of your clock. When I start it up it freezes here:
    Zeddy Clock.JPG
    If I start it holding down the Shift key then start/stop the clock it works just fine. Go figure.

    Forgot to mention Excel 2010 SP-2
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  4. #3
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,826
    Thanks
    136
    Thanked 482 Times in 459 Posts
    Hi RG

    From your screenshot, I see you 'started' my .xlsm file by double-clicking it in a Windows Explorer folder.

    With multiple versions of Excel on my laptop, I am often seeing such startup problems when I open any file by double-clicking it in Windows Explorer. (I'm using Windows7 on that particular laptop.)

    Does it give you a problem if you start Excel 2010 first, and then 'drag' the file from the Windows Explorer folder 'onto' the opened Excel session???
    Does it give you a problem if you start Excel 2010 first, and then point-and-click the file from the Windows Explorer folder???
    Does it give you a problem if you start Excel 2010 first, and then use the menubar File>Open to select the file???

    My Excel2010 version is also SP2 (14.0.7015.1000)

    zeddy

  5. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Quote Originally Posted by zeddy View Post
    Hi RG

    NO - Does it give you a problem if you start Excel 2010 first, and then 'drag' the file from the Windows Explorer folder 'onto' the opened Excel session???
    NO - Does it give you a problem if you start Excel 2010 first, and then point-and-click the file from the Windows Explorer folder???
    NO - Does it give you a problem if you start Excel 2010 first, and then use the menubar File>Open to select the file???
    zeddy
    Zeddy,

    It also has no problem if I select is from the File->Recent Items list. Go Figure!
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  6. #5
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,826
    Thanks
    136
    Thanked 482 Times in 459 Posts
    Hi RG

    A mystery indeed.
    So it only 'freezes' if you try to open it by 'double-clicking' the filename in Explorer????
    Weird.
    I would be interested to hear if others experience this behaviour.

    zeddy

  7. #6
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,826
    Thanks
    136
    Thanked 482 Times in 459 Posts
    Hi All

    The Digital Clock file works nicely when you start Excel2007 (or later) and then open the clock file.
    I still haven't worked out why double-clicking the file in an Explorer window to load excel, and then the file, causes a freeze as reported by RG.

    Does anyone else get this behaviour? Or can anyone else explain it??

    zeddy

  8. #7
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts
    Try changing the Open event to:
    Code:
    Private Sub Workbook_Open()                         'v1.00
       Application.OnTime Now(), "Initialize_Me"
    End Sub
    then create a sub in a new module:
    Code:
    Sub Initialize_Me()
    'The following named cells on the [Parameters] sheet are formatted
    'to display weekday name, day date, month name, and year.
    'They are set to Today's value on workbook open..
    
    [dayNameCell] = Now                                 'set value in named cell
    [dayDateCell] = Now                                 'set value in named cell
    [monthNameCell] = Now                               'set value in named cell
    [yearCell] = Now                                    'set value in named cell
    
    sht01Startup.Select                                 'switch to sheet
    [a1].Select                                         'put cellpointer in tidy location
    startClock
    
    End Sub
    and the problem should go away. (As a general rule, I recommend always using OnTime rather than calling routines directly from the Open event in order to give Excel a chance to finish all its startup operations before it tries to deal with the workbook code)
    Regards,
    Rory

    Microsoft MVP - Excel

  9. The Following User Says Thank You to rory For This Useful Post:

    Gunslinger (2016-06-21)

  10. #8
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Rory,

    Nice! Fixes the freezing problem.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  11. #9
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,826
    Thanks
    136
    Thanked 482 Times in 459 Posts
    Hi RG

    I've updated the clock file with rory's suggested fix, in the attached file.

    I am still a little puzzled though - since the clock file is a macro-enabled file (.xlsm) I would expect users to have to 'enable this content' before any macros can start, even the workbook open event?????
    But, RG, you didn't even get to the 'enable content' message (I presume) because of the 'freeze'????

    Usually, I slip in a 'Do Events' line when I want Excel to 'catch up' with itself.

    zeddy
    Attached Files Attached Files

  12. #10
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,434
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Quote Originally Posted by zeddy View Post
    I would expect users to have to 'enable this content' before any macros can start, even the workbook open event?????
    But, RG, you didn't even get to the 'enable content' message (I presume) because of the 'freeze'????
    Zeddy,

    I have the file in a Trusted Location so I don't have to enable content.
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  13. #11
    WS Lounge VIP
    Join Date
    Mar 2002
    Location
    Newcazzle, UK
    Posts
    2,826
    Thanks
    136
    Thanked 482 Times in 459 Posts
    You're not a fan of the X-Files then???

    ..what would Mulder say!!!

    Anyway, RG, help me out here, how do I insert an image into a post??
    (I wanted to put a picture of the digital clock into the first post.)

    zeddy
    Last edited by zeddy; 2013-08-20 at 05:01. Reason: added text

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •