VBA 项目资源管理器仍然显示由宏关闭的 Excel 工作簿

发布于 2024-12-09 02:10:12 字数 171 浏览 1 评论 0原文

我创建了一个宏,用于打开 Excel 工作簿并执行一些操作,最后关闭文件。该宏运行良好。

现在,当我在 vba 编辑器中打开 VBA 项目资源管理器时。它显示宏已打开的文件列表,即使它们已关闭。如何从项目资源管理器窗口中删除它们?为什么它仍然显示已经关闭的 Excel 工作簿?有没有办法修复它或者它是一个限制?

I have created a macro that opens a excel workbook and performs some operations and then at the end it closes the file.The macro is running fine.

Now, when I open my VBA Project explorer in the vba editor. It shows the list of files that have been opened by the macro even though they are closed. How do i remove them from the project explorer window ? why its still showing the excel workbooks, which are already closed ? is there anyway to fix it or its a limitation?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

小忆控 2024-12-16 02:10:12

我自己找到了答案。

Dim Excel_workbook As Excel.Workbook
Set Excel_workbook = Workbooks.Open("somefile name");
' some code goes here 
' at the end write the below statement
Set Excel_workbook = Nothing 'worked, I found at the 12 page of google search

这是帮助我的链接 http://www.mrexcel.com/forum /showthread.php?t=50086

I found the answer myself.

Dim Excel_workbook As Excel.Workbook
Set Excel_workbook = Workbooks.Open("somefile name");
' some code goes here 
' at the end write the below statement
Set Excel_workbook = Nothing 'worked, I found at the 12 page of google search

This is the link that helped me http://www.mrexcel.com/forum/showthread.php?t=50086

你如我软肋 2024-12-16 02:10:12

进一步的情报。我遇到了同样的问题,并且正在使用 Google Drive(以前的 Google 桌面)。我发现我可以在仍然使用 Google Drive 的同时解决问题,不仅要确保 set wb = Nothing,还要检查
当以编程方式关闭文件时,Application.EnableEvents = True。

希望这对某人有帮助 - 正如上面对我的帮助一样

Further intel. I had the same problem and was using Google Drive (previously Google desktop). I found I could resolve the problem while still using Google Drive by not only ensuring set wb = nothing, but also checking that
Application.EnableEvents = True when the files were programmatically closed.

Hope this helps someone - as the above helped me

烟柳画桥 2024-12-16 02:10:12

我知道这是一个老话题,但我也发生了同样的事情,但这并不是因为同样的问题。

就我而言,问题是 Microsoft Data Streamer for Excel 加载项 - 一旦我停用它,当工作簿关闭时,项目就会从 VBA 中消失。

I know this is an old topic but I had the same thing happening but it wasn't because of the same issue.

In my case the problem was the Microsoft Data Streamer for Excel add-in - once I deactivated it the projects disappeared from VBA when it's workbook was closed.

若相惜即相离 2024-12-16 02:10:12

我通过重新启动电脑成功删除了所有未使用的项目。
其他技巧,例如 Set Excel_workbook = Nothing 或 .Close 只会让事情变得更糟。

I managed to remove all unused projects by restarting my PC.
Other tricks, like Set Excel_workbook = Nothing, or .Close only made things worse.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文