none
excel vba删除右键自定义菜单操作在写入Workbook_Beforeclose事件中不能生效 RRS feed

  • 问题

  • <bdi class="ng-binding" ng-bind-html="message.text | linkify" style="box-sizing:border-box;">我今天用excel vba写程序,添加了几个右键菜单,但是添加以后就删不掉了,放在workbook_beforeclose事件中也无效。我觉得程序没问题</bdi>

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    On Error Resume Next
    DeleteSetting "Statistics of COC", "Clan Wars", "ReadOnlyInfo" & VerCode
    DeleteCB
    On Error GoTo 0
    End Sub

    Sub DeleteCB()
    On Error Resume Next
    Application.EnableEvents = False
    With Excel.Application.CommandBars("Cell") '获取单元格右键快捷菜单命令栏
        .Controls("在上方插入一行并填充公式").Delete
        .Controls("将当前ID上移").Delete
        .Controls("将当前ID下移").Delete
    End With
    On Error GoTo 0
    Application.EnableEvents = True
    End Sub

    2018年7月23日 11:37