标题: 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)