| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 992 人关注过本帖
标题:封装右键菜单没有反应,求指点
只看楼主 加入收藏
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
快速回复:封装右键菜单没有反应,求指点
数据加载中...
 
   



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

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