ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   overlapped functions in vba for excel (https://www.excelbanter.com/excel-programming/349321-overlapped-functions-vba-excel.html)

blinkots

overlapped functions in vba for excel
 
Hello All

I have written a vba app to get data from a device and display it on a
graph in excel. The data is fetched via the serial port using the Win32
communications api. These functions used are overlapped, hence the
other threads & applications run as normal during a relatively slow
communications.

Essentially the overall algorithm is:

cell =1
while cell < 100
if data available or timeout
place data or error in cell
cell++

This locks excel in the while loop, busy and cannot respond to user
commands. How do I put something in this loop to say ' check the rest
of excel needs'?

Thanks in anticipation.

Billy

Bob Phillips[_6_]

overlapped functions in vba for excel
 
Add

DoEvents

in each iteration of the loop.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"blinkots" wrote in message
...
Hello All

I have written a vba app to get data from a device and display it on a
graph in excel. The data is fetched via the serial port using the Win32
communications api. These functions used are overlapped, hence the
other threads & applications run as normal during a relatively slow
communications.

Essentially the overall algorithm is:

cell =1
while cell < 100
if data available or timeout
place data or error in cell
cell++

This locks excel in the while loop, busy and cannot respond to user
commands. How do I put something in this loop to say ' check the rest
of excel needs'?

Thanks in anticipation.

Billy




blinkots

overlapped functions in vba for excel
 
Bob Phillips wrote:
Add

DoEvents

in each iteration of the loop.

Thanks .. this did help.

Billy


All times are GMT +1. The time now is 03:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com