在vb的全局声明中加入这样的例子,Public WithEvents oaddcommandbarbutton1 As Office.CommandBarButton '按钮 Public WithEvents oaddcommandbarbutton2 As Office.CommandBarButton '按钮 Public WithEvents oaddcommandbarbutton3 As Office.CommandBarButton '按钮 Public WithEvents oaddcommandbarbutton4 As Office.CommandBarButton '按钮 Public WithEvents oaddcommandbarbutton5 As Office.CommandBarButton '看验证信息按钮 Public WithEvents oaddcommandbarbutton6 As Office.CommandBarButton '帮助按钮 Public WithEvents oaddcommandbarbutton15 As Office.CommandBarButton '查看原件按钮在AddinInstance_OnConnection事件中增加定义工具栏的命令: Dim oaddcommandbar As CommandBar Dim oaddcommandpopup As CommandBarPopup Dim oaddlistbox As CommandBarComboBox Set oaddcommandbar = Application.CommandBars.Add oaddcommandbar.Name = "你的工具栏的名字" Set oaddcommandbarbutton1 = oaddcommandbar.Controls.Add(msoControlButton) With oaddcommandbarbutton1 .Style = msoButtonIconAndCaption .Caption = "按钮的标题" .FaceId = 50 .ToolTipText = "点击此按钮,可以连接到服务器上并对此word文档进行数字签章" .Visible = True End With 依次类推,最后,编译此vb工程,生成dll文件就可以了。
2、删除系统默认的class模块;2、在工程-部件中要引用“设计器”-“Addin class”;3、此时,在“工程”菜单中就多了一个“添加Addin class”,点击添加一个此类;4、在界面上可以选择要嵌入的office程序类型,word,outlook,excel等等都可以;5、接下来就是写程序了。
Public WithEvents oaddcommandbarbutton2 As Office.CommandBarButton '按钮
Public WithEvents oaddcommandbarbutton3 As Office.CommandBarButton '按钮
Public WithEvents oaddcommandbarbutton4 As Office.CommandBarButton '按钮
Public WithEvents oaddcommandbarbutton5 As Office.CommandBarButton '看验证信息按钮
Public WithEvents oaddcommandbarbutton6 As Office.CommandBarButton '帮助按钮
Public WithEvents oaddcommandbarbutton15 As Office.CommandBarButton '查看原件按钮在AddinInstance_OnConnection事件中增加定义工具栏的命令:
Dim oaddcommandbar As CommandBar
Dim oaddcommandpopup As CommandBarPopup
Dim oaddlistbox As CommandBarComboBox
Set oaddcommandbar = Application.CommandBars.Add
oaddcommandbar.Name = "你的工具栏的名字"
Set oaddcommandbarbutton1 = oaddcommandbar.Controls.Add(msoControlButton)
With oaddcommandbarbutton1
.Style = msoButtonIconAndCaption
.Caption = "按钮的标题"
.FaceId = 50
.ToolTipText = "点击此按钮,可以连接到服务器上并对此word文档进行数字签章"
.Visible = True
End With
依次类推,最后,编译此vb工程,生成dll文件就可以了。