Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Excel加载项-图标消失_Excel_Vba_Excel Addins - Fatal编程技术网

Excel加载项-图标消失

Excel加载项-图标消失,excel,vba,excel-addins,Excel,Vba,Excel Addins,我创建了一个包含多个宏的Excel加载项。我在.xlam文件中的“ThisWorkbook”中添加了以下代码。我可以通过“开发人员”选项卡上的“Excel加载项”按钮激活加载项。当我关闭工作簿并重新打开它时,外接程序仍然通过“Excel外接程序”按钮激活,但宏徽标不再显示在“外接程序”选项卡上。知道为什么会这样吗?加载项未被禁用,它们位于受信任的文件位置 用于在“加载项”选项卡上创建按钮的代码 通过“Excel加载项”按钮停用加载项时,从“加载项”选项卡中删除按钮的代码 Private Sub

我创建了一个包含多个宏的Excel加载项。我在.xlam文件中的“ThisWorkbook”中添加了以下代码。我可以通过“开发人员”选项卡上的“Excel加载项”按钮激活加载项。当我关闭工作簿并重新打开它时,外接程序仍然通过“Excel外接程序”按钮激活,但宏徽标不再显示在“外接程序”选项卡上。知道为什么会这样吗?加载项未被禁用,它们位于受信任的文件位置

用于在“加载项”选项卡上创建按钮的代码

通过“Excel加载项”按钮停用加载项时,从“加载项”选项卡中删除按钮的代码

Private Sub Workbook_AddinInstall()

    With Application.CommandBars("Standard").Controls.Add
        .Caption = "Save New Version"
        .FaceId = 3
        .Style = msoButtonIconAndCaptionBelow
        .OnAction = "Version_Save"
    End With
        
    With Application.CommandBars("Standard").Controls.Add
        .Caption = "Create Delivery Workbook"
        .FaceId = 263
        .Style = msoButtonIconAndCaptionBelow
        .OnAction = "DeliveryWorkbook"
    End With

End Sub
Private Sub Workbook_AddinUninstall()

    On Error Resume Next
        Application.CommandBars("Standard").Controls("Save New Version").Delete
        Application.CommandBars("Standard").Controls("Create Delivery Workbook").Delete

End Sub