Office中国论坛/Access中国论坛

标题: OFFCE加载项运行无结果 [打印本页]

作者: cxloen    时间: 2016-9-29 17:20
标题: OFFCE加载项运行无结果
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



作者: cxloen    时间: 2016-9-29 17:21
请教高人为什么点击按钮不弹出一个对话框
作者: cxloen    时间: 2016-9-30 11:05
已解决 加TAG
作者: 淡定强    时间: 2016-10-8 13:26
为什么 只运行一次?




欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3