不知道大家用过FOXMAIL没有当你用过FOXMAIL了以后,你的WORD的工具栏里就会有一个FOXMAIL的小图标,点了以后,就会新建一个信,并把你的WORD文档作为附件。现在我就想实现在WORD工具栏里能增加一个我的程序的图标,应该如何实现呢???

解决方案 »

  1.   

    1、新建一个activex dll工程;
    2、删除系统默认的class模块;2、在工程-部件中要引用“设计器”-“Addin class”;3、此时,在“工程”菜单中就多了一个“添加Addin class”,点击添加一个此类;4、在界面上可以选择要嵌入的office程序类型,word,outlook,excel等等都可以;5、接下来就是写程序了。
      

  2.   

    在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文件就可以了。
      

  3.   

    以上仅仅为例子,还达不到真正实用的地步,要想实用,必须要参考vba的开发帮助,有许多需要注意的地方的。