通过 VBA 宏打开 MS Excel 时禁用“更新链接消息”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12735115/
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
Disable "update links message" when opening MS Excel via VBA Macro
提问by BrOSs
I'm doing an auto-run macro, but it is password protected. After I removed all the passwords, it can save the file in a different format.
我正在做一个自动运行的宏,但它受密码保护。删除所有密码后,它可以以不同的格式保存文件。
The thing is that MS Excel displays a Popup Message about "update links automatically". I Tried to disable all settings from MS Excel options but the dialog still appearing.
问题是 MS Excel 会显示一条关于“自动更新链接”的弹出消息。我试图禁用 MS Excel 选项中的所有设置,但对话框仍然出现。
So, I was thinking to add some code to avoid that popup.
所以,我想添加一些代码来避免弹出窗口。
Here is my code:
这是我的代码:
Sub Auto_Open()
Workbooks.Open "C:\Test\WorkbookTest.xlsx"
ActiveWorkbook.UnprotectSharing ("galleta")
ActiveSheet.Unprotect ("galleta")
ChDir "C:\Users\user\Desktop\Reportes"
Sheets("BES").Select
ActiveSheet.Unprotect ("galleta")
Sheets("BE800").Select
ActiveSheet.Unprotect ("galleta")
Sheets("BECM").Select
ActiveSheet.Unprotect ("galleta")
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\user\Desktop\Reportes\test.mht", FileFormat:= _
xlWebArchive, CreateBackup:=False
End Sub
I placed my autorun with the password thing code because it may help to someone.
我将自动运行与密码事物代码放在一起,因为它可能对某人有所帮助。
Other data:
其他数据:
- Office 2007,
- Windows Server 2008 R2.
- 办公室 2007,
- Windows Server 2008 R2。
The message is appearing to protect the user's platform, but may be we can configure the user preference forehand via vba.
该消息似乎是为了保护用户的平台,但我们可能可以通过vba正手配置用户偏好。
Thank you guys.
谢谢你们。
回答by Doug Glancy
The second argument to Workbooks.Open is UpdateLinks. Set it to False:
Workbooks.Open 的第二个参数是 UpdateLinks。将其设置为 False:
Workbooks.Open "C:\Test\WorkbookTest.xlsx",False