gpt4 book ai didi

excel - 取消隐藏 Excel 应用程序 session

转载 作者:行者123 更新时间:2023-12-02 00:45:13 25 4
gpt4 key购买 nike

我有一个运行的 Excel VBA 方法(我没有编写它),它所做的第一件事就是隐藏 Excel session Application.Visible = False

但是,当该方法完成后,它不会取消隐藏 Excel session ,因此它保持打开状态并列在任务管理器中,但处于隐藏状态并且看起来无法使用。

有谁知道,在没有打开 VBE(以便可以访问立即窗口并运行 Application.Visible = True)的情况下,如何取消隐藏此 Excel session ?目前,我只需使用任务管理器终止 session 即可。

这不是什么大不了的事,但我只是感兴趣是否有人知道如何恢复这样的 session 。

最佳答案

Like I said, it's not a big deal but was just interested if anyone knew of shortcut key or anything to bring it back.

据我所知,没有捷径,但您可以这样做。

打开 MS Word 并将此代码粘贴到 VBA 编辑器中。关闭所有可见的打开的 Excel 实例,然后运行此代码。这将使隐藏的实例可见。手动关闭实例,如果还有更多实例,请重复该过程。

Option Explicit

Sub Sample()
Dim oXLApp As Object

'~~> Get an existing instance of an EXCEL application object
On Error Resume Next
Set oXLApp = GetObject(, "Excel.Application")
On Error GoTo 0

oXLApp.Visible = True

Set oXLApp = Nothing
End Sub

我不是故意使用循环,因为隐藏实例可以有一个您可能想要保存的工作簿?

如果您愿意,您可以将上述代码转换为可直接从桌面运行的 VB 脚本文档。

Unfortunately, I don't have the control to make the changes required.

你到底是什么意思? VBA 密码 protected 吗?如果没有,那么我的建议仍然与之前相同

This is a case of poor programming. Even if we give a code to close all hidden Excel instances, that won't help you. Because next time you run that macro, you will face the same problem again. Why not edit the existing code and add Application.Visible = True at the end? Is the VBA password protected? – Siddharth Rout 28 mins ago

关于excel - 取消隐藏 Excel 应用程序 session ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10294268/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com