如何在vb.net中的Ms word中禁用SaveAs

时间:2012-09-28 15:43:44

标签: vba ms-office

如何在使用vb.net的MS word或任何其他办公室中禁用另存为?

1 个答案:

答案 0 :(得分:1)

您需要使用VBA宏来禁用“另存为选项”。 在Excel中禁用的代码是:

 Private Sub Workbook_BeforeSave (ByVal SaveAsUI As Boolean, Cancel As Boolean)

'This macro disables the "Save As" Feature in Excel
'This means that a user will not be able to save this
'workbook(file) under a different name or in a different location
'
'This MUST be placed in "ThisWorkbook" and NOT in a Module.
'

    If SaveAsUI = True Then Cancel = True

End Sub