Excel工作簿从内容中打开事件? [英] Excel Workbook Open event from within an addin?

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

问题描述

我打算在打开Excel文档时触发一个宏来运行。

I am trying to trigger a macro to run when an Excel document is opened.

我遇到的问题是我的所有代码都在Excel加载项中。 Workbook_Open事件不起作用,因为我不能将代码放在单个文档中,我需要它驻留在加载项中,并在任何文档打开时运行。

The problem I am running into is that all of my code resides within an Excel add-in. The Workbook_Open event doesn't work because I can't put the code in individual documents, I need it to reside in the add-in and run whenever any document is opened.

有没有办法修改Workbook_Open事件?还有另外一种方法可以在打开不同的文档时触发宏?

Is there a way to modify the Workbook_Open event or is there another way to trigger a macro when a different document is opened?

推荐答案

p>您需要使用应用程序事件。在Chip Pearson的网站此处上,如何做到这一点。

You need to use an Application event. There is a good writeup on how to do this at Chip Pearson's site here.

这篇关于Excel工作簿从内容中打开事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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