禁用"另存为"在Word 2013中使用VBA

时间:2016-03-04 03:32:00

标签: vba ms-word word-vba

如何在Word 2013中禁用“另存为”选项? 我已经尝试了下面列出的所有以下命令,但事件从未被捕获。正常"保存"总是被困,无论是通过图标还是Word文件命令。线程已经提到更改File命令XML,但我无法访问Visual Studio。

Sub Document_BeforeClose(Cancel As Boolean)
MsgBox ("Save Disallowed")
End Sub

Sub Document_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
MsgBox ("Save Disallowed")
 End Sub

Sub wd_DocumentBeforeSaveAs(ByVal Doc As Document, _
             SaveAsUI As Boolean, Cancel As Boolean)
MsgBox ("Save Disallowed")
End Sub

Sub oApp_DocumentBeforeSave( _
        ByVal Doc As Document, _
        SaveAsUI As Boolean, _
        Cancel As Boolean)
MsgBox ("Save Disallowed")
End Sub

Sub FileSave()
MsgBox ("Save Disallowed")
End Sub

Sub FileSaveAs()
MsgBox ("Save Disallowed")
End Sub

Sub FileSaveAsWebPage()
MsgBox ("Save Disallowed")
End Sub

Sub FileSaveHtml()
MsgBox ("Save Disallowed")
End Sub

Sub SaveTemplate()
MsgBox ("Save Disallowed")
End Sub

Sub FileSaveFrameAs()
MsgBox ("Save Disallowed")
End Sub

1 个答案:

答案 0 :(得分:0)

最后找到答案,是的,DocumentBeforeSave命令确实有效,但诀窍在于知道它必须去哪里。

在这里找到答案....

Word VBA - DocumentBeforeSave event?

解决方案很有效!