Excel工作簿打开事件宏不总是运行 [英] Excel Workbook Open Event macro doesn't always run

查看:307
本文介绍了Excel工作簿打开事件宏不总是运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Workbook_Open事件宏(它在ThisWorkbook中)并不总是运行。

I've got a Workbook_Open event macro (and it's in ThisWorkbook) that doesn't always run.


  • 如果Excel已关闭我从Windows资源管理器中双击.xls文件,它运行。

  • 如果我从启动/程序启动Excel(没有.xls文件),然后打开文件,它确实运行。

  • 如果我已经在Excel中打开该文件,但是关闭该文件(将Excel打开)并重新打开,则宏不会运行。

我的安全设置为中等,每当打开宏时,我启用宏。

I've got security set to medium and I enable macros whenever it opens.

我需要做什么才能使宏运行,只要我打开它,而不仅仅是第一次这个Excel会话?

What do I need to do to get the macro to run whenever I open it, not just the first time for this Excel session?

(btw,这是Excel 2003)

(btw, this is Excel 2003)

推荐答案

我以为这是(这是我的长期以来从未解释过Excel完全不稳定的错误。)(死链接)

I thought that this was the most cogent article on this problem (which is a long-standing never explained completely erratic bug that Excel exhibits). (dead link)

简而言之,在许多情况下,这是因为工作簿正在尝试计算打开的东西,并阻碍了Workbook_Open事件。测试你的方式,看看是否是为了这种情况,首先要重命名单元格调用的任何UDF或宏,这样它们就不会被调用,看看是否改变了。

In short, in many cases it's a timing thing caused because the workbook is trying to calculate stuff when it opens and that gets in the way of the Workbook_Open event. The way to test on yours to see if that it for this situation, is to first rename any UDFs or Macros called by cells so that they won't get called and see if that changes anything.

这篇关于Excel工作簿打开事件宏不总是运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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