VBA interrupts...

L

Lyndon

Hi all,

Does VBA allow process interrupts from a Timer and if so, how is this
implemented..? I have written a simple progress bar in the status bar
and have a timer created using the following API commands:

Public Declare Function SetTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long, _
ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
Public Declare Function KillTimer Lib "user32" ( _
ByVal HWnd As Long, ByVal nIDEvent As Long) As Long

When I set the timer it calls my specified on every interval. I was
hoping to use this timer to increment my progress bar.

The task that is taking a while to execute is as follows:

dim rstData as ADODB.Recordset
Set rstData = New ADODB.Recordset

rstData.Open "C:\Temp\outRS.rst"

Opening this persistent recordset takes about 30 seconds and being a
VBA function I cannot access the code that loops and reads in this
recordset to add a DoEvents or the code to update the progress bar. I
was hoping that the Timer I have created would interrupt this process,
call the progress bar update procedure and then resume the load but
this is not the case. How can I implement a progress bar when one
statement takes 30seconds and I want a progress indication of that..?

Thanks in advance,
Lyndon.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top