+ Reply to Thread
Results 1 to 3 of 3

How does Excel/VBA handle concurrent events?

  1. #1
    Registered User
    Join Date
    12-05-2006
    Location
    Philadelphia PA
    MS-Off Ver
    Office 365
    Posts
    81

    How does Excel/VBA handle concurrent events?

    I have an application in which as many as 30 worksheets experience externally triggered Worksheet_Calculate events. The real time triggers come via a COM interface link, and are completely random. Typically there are about 200,000 events in a 6.5 hour period, so the probability that some events will be virtually simultaneous is high. Each event runs worksheet_calc code in its own sheet and calls another routine, common to all worksheets, as well.

    Although the application works quite well I have concerns about concurrent events. What happens if a new calc event occurs while VBA is still executing the code triggered by the most recent prior event? Does Excel queue the events for orderly disposal? Or does the newest one interrupt any ongoing operation from the previous event? If events are not queued, what happens to them? If they are queued, how many can be stacked? Is it a FIFO or FILO queue?

    I would like to understand just how Excel & VBA deal with this situation. An explanation longer than a brief overview might well be too long for the forum. So I would be happy if someone could point me to an info source, something like a Microsoft knowledge base article or the like.

    Thanks for any words of wisdom you can offer.

  2. #2
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: How does Excel/VBA handle concurrent events?

    Interesting Thread. I have no experience with that many events triggered simultaneous. Could you not find this out by having a call to a sub that stores the "caller" and a timestamp (sequencial number) at the beginning of each sub/function?

    As you are in control with the events (at least the subs/functions that follow), is it necessary to have a recalc every time?

    I'll follow your post...
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  3. #3
    Registered User
    Join Date
    12-05-2006
    Location
    Philadelphia PA
    MS-Off Ver
    Office 365
    Posts
    81

    Re: How does Excel/VBA handle concurrent events?

    Hi rwgrietveld, You're the only responder so far.

    The (re)calc is the result of a data update promulgated by a remote server into a complex Excel array formula, which was created by client side software installed on my PC. So every data update (about 200,000 a day) causes a single calc event, and my VBA code has to look at every one to see what may have to be done with the new data (most often nothing), and then act accordingly. So I have very limited control over the events, and I'm concerned that due to the randomness of data updates some virtually simultaneous events may be lost or improperly handled.

    I'm now going to submit the original question, slightly modified, to the Just Answer organization that advertises on the this Forum. I spent some time searching the MS Knowledge base and one or two other sources, to no avail. If and when I get a suitable answer I will post it here so everyone can benefit.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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