简体   繁体   中英

Excel VBA slows down when excel is not the front window

I have many different VBA macros that are commanded to run by an analysis sequence this analyser sequence and a Labview VI also reads and takes information that has been calculated in the excel spreadsheet.

The analysis sequence has timers and delays that you can see counting down during which it checks on the status certain cells of the excel spreadsheet.

All the analysis sequences, excel VBA macros and Labview VIs work perfectly but only when the excel window is running in front. if any other window is selected the calculations slow down which means the delay timers shown on the other sequences also slow down 5 or 6 times slower.

This becomes a problem because the Labview VI has buttons to select options meaning in normal operation the excel sheet won't be in front.

I have tried changing priorities in the task manager which changes nothing and making things run on different CPUs which again does nothing. the CPU is running around 50% all the time but the CPU usage of excel jumps from 2 or 3 when excel window is up front to around 50 when another window is selected.

I've also made the macros as streamlines as i can think of doing by turning of screen updating and so on.

A fix like the VBA code bringing the sheet to the from will be just as good as having the excel window permanently at the front. but an idea of what could be causing the issue would be much appreciated.

Thank you in advance

You could try setting your Windows environment to adjust for best performance of background services.

http://www.ni.com/white-paper/3773/en/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM