ScreenUpdating = False在Excel 2013和2016中失败 [英] ScreenUpdating = False fails in Excel 2013 and 2016

查看:108
本文介绍了ScreenUpdating = False在Excel 2013和2016中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我几年前开发的,长期运行的,基于Excel的高端应用程序在Excel 2007和2010中运行得很好,因为Application.ScreenUpdating = False不再可靠地工作,它们看起来像Excel 2013和2016中的Amateur Hour.

Long-running, high-end Excel-based applications that I developed years ago and that run beautifully in Excel 2007 and 2010 look like Amateur Hour in Excel 2013 and 2016 because Application.ScreenUpdating = False no longer works reliably.

当VBA代码将宏工作簿中的预格式化工作表复制到新工作簿中时,屏幕显然会冻结,尽管其他情况也必须触发它.

The screen unfreezes apparently when VBA code copies a preformatted worksheet from the macro workbook into a new workbook, although other circumstances must trigger it as well.

我看过关于此主题的主题,这些主题建议摆弄代码"或在子例程中调用代码".不幸的是,我必须维护数百个Excel应用程序,每个应用程序都包含成千上万的代码行以及数百个将要迁移到Office 2016的用户,因此无法进行重写.如何恢复Excel以前的优雅?

I’ve seen the threads on this subject that recommend "fiddling with the code" or "calling the code in a subroutine". Unfortunately, I have to maintain hundreds of Excel applications each with thousands of lines of code and hundreds of users who are about to migrate to Office 2016, so rewriting is not an option. How can I recover Excel’s former elegance?

推荐答案

此处是一种有助于减少闪烁并保留StatusBar消息的技术.

Here is a technique that helps reduce flickering and preserves the StatusBar message.

Application.Cursor = xlWait
Application.ScreenUpdating = False
. . .
Set wkbNewBook = Workbooks.Add
ThisWorkbook.Windows(1).Visible = False
. . .
ThisWorkbook.Windows(1).Visible = True
wkbNewBook.Activate
Application.ScreenUpdating = True
Application.Cursor = xlDefault

这篇关于ScreenUpdating = False在Excel 2013和2016中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆