标题:封装右键菜单没有反应,求指点
只看楼主
cunfu2010
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2017-4-6
 问题点数:0 回复次数:0 
封装右键菜单没有反应,求指点
Option Explicit
Public xlApp As Excel.Application
Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
    Set xlApp = Application
    CreateToolbarButtons
End Sub
Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
    Set xlApp = Nothing
End Sub

Public Sub CreateToolbarButtons()
    Dim cbBar As
    Dim btNew As
    On Error Resume Next
    ("cell").Reset
    Set cbBar = ("cell").Controls.Add(msoControlPopup, Before:=1)
    cbBar.Caption = "调试"
    Set btNew = cbBar.Controls.Add(1, 2)
    With btNew
        .Caption = "调试"
        .OnAction = "test1"
    End With
End Sub

Sub test1()
    MsgBox "你成功了!"
End Sub

[此贴子已经被作者于2022-3-31 15:40编辑过]

搜索更多相关主题的帖子: Application ByVal End Sub Set 
2022-03-31 15:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-508734-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.379917 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved