+ Reply to Thread
Results 1 to 6 of 6

VBA strange behavior On time events firing at unexpected time intervals.

  1. #1
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    VBA strange behavior On time events firing at unexpected time intervals.

    Slowly getting there with VBA but something i've (had help) written isn't behaving as it should, i'm struggling to understand why?

    THIS WORKBOOK CODE
    Please Login or Register  to view this content.
    MODULE CODE
    Please Login or Register  to view this content.
    SHEET LEVEL CODE
    Please Login or Register  to view this content.
    EXPECTED BEHAVIOR:
    after 14 minutes and 30 seconds inactivity within the workbook a userform should pop up with a 30 second countdown asking the user if they still need the workbook open. a YES response starts a 4 minute 30 second countdown where the same userform is presented, a NO response or a timeout results in the workbook saving and closing. (need to reliably ensure this happens even if the workbook isn't the active application taking focus somehow)

    ACTUAL BEHAVIOR:
    userform is presented after a few seconds with the 30 second countdown, and re-presented a few seconds later when YES button clicked.

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: VBA strange behavior On time events firing at unexpected time intervals.

    I think its the way you have your timers set up

    When you set your 15minute inactivity counter, so Now+15mins, you need to set your countdown one to but for now+14m30s, this one will just open the userform. In the userform, you'll have a cancel on the 14m30s one, and set up a new 1s timer to do the countdown.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Re: VBA strange behavior On time events firing at unexpected time intervals.

    GRRR!!!

    I've tried implementing your idea which sounds like it should solve the problem, i think I've done it poorly as I've made the situation far far worse. (Thankfully i've the code saved here so I can fix it).

    I have the file closing itself after a few seconds or even after I press Yes in the userform (which should have given me 5 minutes).

  4. #4
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Re: VBA strange behavior On time events firing at unexpected time intervals.

    I have literally spent 3 days on this and seem to only make things worse rather than better - if anyone could take a look at this and provide the code to show what i'm doing wrong - you'd be saving me one helluva migraine.

    Thank you

  5. #5
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Re: VBA strange behavior On time events firing at unexpected time intervals.

    shameless bump, please help restore my sanity

  6. #6
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: VBA strange behavior On time events firing at unexpected time intervals.

    Workbook code

    Please Login or Register  to view this content.
    Module code

    Please Login or Register  to view this content.
    This is for 1minute main delay, 30 seconds for countdown. You will also need to stop the countdown when the counter gets to 0

  7. #7
    Forum Contributor
    Join Date
    09-05-2011
    Location
    Essex, England
    MS-Off Ver
    Excel 2003 Excel 2007
    Posts
    383

    Re: VBA strange behavior On time events firing at unexpected time intervals.

    worked like a charm thank you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Grouping events based on Time Intervals in Pivots
    By hutch2hutch in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 06-13-2013, 05:10 AM
  2. [SOLVED] Time intervals SUM unexpected result
    By NunoDinis in forum Excel General
    Replies: 11
    Last Post: 06-04-2012, 12:58 PM
  3. Converting Data in Irregular Time Intervals into Regular Time Intervals
    By AlexJT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2011, 02:42 AM
  4. Need to Transpose Irregular Time Intervals into Regular Time Intervals
    By AlexJT in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2011, 08:30 PM
  5. Rounding Time Intervals to the Nearest Specified Time Increment
    By ExcelTip in forum Tips and Tutorials
    Replies: 0
    Last Post: 08-23-2005, 12:21 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1