Office 2010,在退出受保护的视图后,激活工作表在Workbook_Open中失败 [英] Office 2010, activating sheet fails in Workbook_Open after going out of protected view
问题描述
从受保护视图中的Intranet打开的xls文件
它有一个由Workbook_Open事件触发的过程
第一行代码激活一个表格由其代号
在用户点击"无论如何编辑"之后它就失败了退出受保护的视图,但从运行宏窗体(ALT + F8)再次启动它时工作正常
这是Office中的错误吗?有没有解决方法?
要打开的工作表还有工作簿名称参考吗?也许它失败了,因为代码试图在活动工作簿中打开工作表(例如,如果用户打开了另一个Excel会话,则可能不是这种情况)。
如果这是案例,尝试更改
表格(< sheetName>)。激活
工作簿( < workBookName>)床单(小于。SHEETNAME>)激活
xls file opened from intranet in protected view
It has a procedure triggered by Workbook_Open event
First line of code activates one sheet by its codename
It fails just after user clicks "edit anyway" to go out of protected view but it works fine when is launched again from run macro form (ALT+F8)
Is it a bug in Office? Is there any workaround?
The sheet to open has the workbook name reference as well? Maybe it's failing because the code is trying to open the sheet in the active workbook (which may not be the case if the user has another Excel session opened, for instance).
If that's the case, try to change
Sheets(<sheetName>).Activate
for
Workbooks(<workBookName>).Sheets(<sheetName>).Activate
这篇关于Office 2010,在退出受保护的视图后,激活工作表在Workbook_Open中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!