关闭之前的工作簿对某些人不起作用,但对另一些人起作用

时间:2019-06-05 10:51:22

标签: excel vba

我有以下代码适用于某些人,但不适用于其他人。 打开电子表格时,以下步骤与之相反。 可能是它出色的设置吗?

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim Control As Office.CommandBarControl

Application.CommandBars("ply").Enabled = True     'disables right-Click on 
sheet tab

For Each Control In Application.CommandBars.FindControls(ID:=21)    
'disables CUT
Control.Enabled = True
Next Control For Each Control In 
Application.CommandBars.FindControls(ID:=19)     'disables COPY
    Control.Enabled = True
 Next Control

Application.DisplayFormulaBar = True
Application.CutCopyMode = True
Application.CellDragAndDrop = True

End Sub

0 个答案:

没有答案