简体   繁体   English

当Excel不是前窗口时,Excel VBA会变慢

[英]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. 我有许多不同的VBA宏,由该分析程序序列的分析序列命令运行,并且Labview VI还读取并获取在Excel电子表格中计算出的信息。

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. 分析序列具有计时器和延迟,您可以在分析序列期间检查excel电子表格的某些单元格的状态。

All the analysis sequences, excel VBA macros and Labview VIs work perfectly but only when the excel window is running in front. 所有分析序列,excel VBA宏和Labview VI都可以正常运行,但前提是excel窗口在前面运行。 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. 如果选择任何其他窗口,则计算速度会变慢,这意味着其他序列上显示的延迟计时器也会变慢5到6倍。

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. 由于Labview VI具有选择选项的按钮,这意味着出现问题,这意味着在正常操作中excel表不会在前面。

I have tried changing priorities in the task manager which changes nothing and making things run on different CPUs which again does nothing. 我曾尝试在任务管理器中更改优先级,而该任务管理器不更改任何内容,并使事情在不同的CPU上运行,而这些CPU再次不执行任何操作。 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. CPU一直在运行50%左右,但是excel的CPU使用率从excel窗口在前时的2或3跳到了选择另一个窗口时的50左右。

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. 像VBA代码这样的将表格从表头移到桌面的修复程序将与将excel窗口永久地放在前面一样好。 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. 您可以尝试设置Windows环境以调整后台服务的最佳性能。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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