设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 2146|回复: 3
打印 上一主题 下一主题

OFFCE加载项运行无结果

[复制链接]
跳转到指定楼层
1#
发表于 2016-9-29 17:20:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Public Class ThisAddIn

    Private Sub ThisAddIn_Startup() Handles Me.Startup
        AddCommandBar()
    End Sub

    Private Sub ThisAddIn_Shutdown() Handles Me.Shutdown
        If mCommandBar IsNot Nothing Then
            mCommandBar.Delete()
        End If

    End Sub
    Private mCommandbar As Office.CommandBar
    Private Sub AddCommandBar()
        Try
            mCommandbar = Application.CommandBars.Add("1", Office.MsoBarPosition.msoBarTop, True, False)
            If mCommandbar IsNot Nothing Then
                Dim commandBtn As Office.CommandBarButton = mCommandbar.Controls.Add(Office.MsoControlType.msoControlButton)
                With commandBtn
                    .Caption = "试手"
                    .FaceId = 59
                    .Style = Microsoft.Office.Core.MsoButtonStyle.msoButtonCaption
                    .Visible = True
                    AddHandler .Click, AddressOf c1_Click

                End With
         

                mCommandbar.Visible = True

            End If



        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub
    Private Sub c1_Click(control As Office.CommandBarButton, ByRef cancel As Boolean)

        MsgBox("1")
    End Sub

End Class


分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
 楼主| 发表于 2016-9-29 17:21:58 | 只看该作者
请教高人为什么点击按钮不弹出一个对话框
3#
 楼主| 发表于 2016-9-30 11:05:44 | 只看该作者
已解决 加TAG
4#
发表于 2016-10-8 13:26:07 | 只看该作者
为什么 只运行一次?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-4-27 03:04 , Processed in 0.083430 second(s), 27 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表