vba 如何使 Office 2013/2016 应用程序在 Microsoft Windows 上的单独进程中运行?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17333208/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 21:53:48  来源:igfitidea点击:

How do I make an Office 2013/2016 application run in separate process on Microsoft Windows?

excelvbavstooffice-interopoffice-2013

提问by Ling

I am developing a Excel plugin. It works all right for Excel versions before 2013. But a lot of features is broken when it runs against Excel 2013. I found the root cause is all windows are running in only one process in Excel 2013. Even if user explicitly launch a new window by double-clicking the shortcut on the desktop or by clicking the item in the start menu, no new process is created. This results in the status conflict between processes. Status bar and ribbon is shared. For instance, when I update the status bar information in one window, the other windows' are also updated. When I check/uncheck a ribbon button in one window, the other windows' buttons are also checked/unchecked. I think a possible solution is to change some configurations to make it work as before. But I found nothing relevant by searching on google.

我正在开发一个 Excel 插件。它适用于 2013 年之前的 Excel 版本。但是当它针对 Excel 2013 运行时,很多功能都被破坏了。我发现根本原因是所有窗口都只在 Excel 2013 中的一个进程中运行。即使用户明确启动一个新窗口通过双击桌面上的快捷方式或单击开始菜单中的项目,不会创建新进程。这导致进程之间的状态冲突。状态栏和功能区是共享的。例如,当我更新一个窗口中的状态栏信息时,其他窗口的状态栏信息也随之更新。当我在一个窗口中选中/取消选中功能区按钮时,其他窗口的按钮也被选中/取消选中。我认为一个可能的解决方案是更改一些配置以使其像以前一样工作。但是我在谷歌上搜索没有发现任何相关的内容。

Does anyone know how to make it or is there any other solution?

有谁知道如何制作或有其他解决方案吗?

回答by yangyonghuiwp

With Excel 2013, the default you have is to create a new window within the existing Excel process. In order to force the creation of a separate instance of the Excel process, you have these options:

对于 Excel 2013,您的默认设置是在现有 Excel 进程中创建一个新窗口。为了强制创建 Excel 流程的单独实例,您有以下选项:

Option 1

选项1

From the command prompt, run EXCEL /X and you will open Excel window as a new instance. The /X command switch forces the creation of a new instance.

在命令提示符下,运行 EXCEL /X,您将打开 Excel 窗口作为新实例。/X 命令开关强制创建新实例。

Option 2

选项 2

  1. Right click on the Excel icon in Windows taskbar enter image description here
  2. Go down to where it lists the application enter image description here
  3. Hold down the ALT key on the keyboard and click "Excel 2013/2016"
  4. It should give you this prompt, "Do you want to start a new instance of Excel?" enter image description here
  5. Click "Yes!"
  1. 右键单击 Windows 任务栏中的 Excel 图标 在此处输入图片说明
  2. 转到列出应用程序的位置 在此处输入图片说明
  3. 按住键盘上的 ALT 键并单击“Excel 2013/2016”
  4. 它应该给你这个提示,“你想启动一个新的 Excel 实例吗?” 在此处输入图片说明
  5. 点击“是!”

Option 3

选项 3

Use this technique to open an existing document directly:

使用此技术直接打开现有文档:

  1. Hold down Alt.
  2. Right click Excel file.
  3. Click Open.
  4. Continue holding down Alt until the "Do you want to start a new instance of Excel" dialogue pops up.
  5. Click Yes.
  1. 按住 Alt。
  2. 右键单击 Excel 文件。
  3. 单击打开。
  4. 继续按住 Alt 直到弹出“是否要启动新的 Excel 实例”对话框。
  5. 单击是。

For more detail,please visit: http://sqlblog.com/blogs/marco_russo/archive/2012/07/24/running-excel-2013-in-a-separate-instance-excel-powerpivot.aspx

更多详情,请访问:http: //sqlblog.com/blogs/marco_russo/archive/2012/07/24/running-excel-2013-in-a-separate-instance-excel-powerpivot.aspx

回答by SMacLaren

re. "Right click on the Excel Tab in Windows taskbar keeping the ALT key pressed"
-This option is not available in Windows 10with Excel 2016. However, the Excel /X option works and a second change-undo buffer is created, as noted above, in the new process.

关于。“右键单击 Windows 任务栏中的 Excel 选项卡并按住 ALT 键
-此选项在带有 Excel 2016 的Windows 10 中不可用。但是,Excel /X 选项有效并且创建了第二个更改撤消缓冲区,如上所述,在新的过程中。