| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 873 人关注过本帖
标题:用VB6制作Excel2003自定义菜单
取消只看楼主 加入收藏
opelwang
Rank: 1
等 级:新手上路
帖 子:78
专家分:3
注 册:2009-7-2
结帖率:77.78%
收藏
已结贴  问题点数:10 回复次数:3 
用VB6制作Excel2003自定义菜单
用VB6制作Excel2003自定义菜单,如何定义图标。
图片附件: 游客没有浏览图片的权限,请 登录注册

以下有源码,是用内置的.FaceId图标。
我想用自定义图标,把图片加载到资源管理器,然后调用。
求解,谢谢:

[ 本帖最后由 opelwang 于 2013-9-24 12:05 编辑 ]
搜索更多相关主题的帖子: 资源管理器 图片 制作 如何 
2013-09-23 21:15
opelwang
Rank: 1
等 级:新手上路
帖 子:78
专家分:3
注 册:2009-7-2
收藏
得分:0 
自己顶一下,无人跟贴,我还是把代码贴出来,这样比较直观,方便大家予以指点,谢谢。

------------------------------------------------------------------------------------------------

标准模块(Module1:)
Public xlapp As Excel.Application
Public MenuEvents As ToolsMenuEvents

类模块(ToolsMenuEvents)
Private WithEvents btnMenuItem1 As
Private WithEvents btnMenuItem2 As
Private WithEvents btnMenuItem As

Sub CreateMenuItems()
    With (1).Controls.Add(Type:=msoControlPopup, Temporary:=True)
        .Caption = "MyToolBar"
        Set btnMenuItem1 = .Controls.Add
        With btnMenuItem1
            .Caption = "计算"
            .BeginGroup = True
            .FaceId = 23
        End With
        Set btnMenuItem2 = .Controls.Add
        With btnMenuItem2
            .Caption = "统计"
            .BeginGroup = False
            .FaceId = 24
        End With
    End With
End Sub

Sub DeleteMenuItems()
    On Error Resume Next
    (1).Controls("MyToolBar").Delete
End Sub

Private Sub btnMenuItem1_Click(ByVal Ctrl As , CancelDefault As Boolean)
    MsgBox "计算"
End Sub

Private Sub btnMenuItem2_Click(ByVal Ctrl As , CancelDefault As Boolean)
    MsgBox "统计"
End Sub

设计器(Connect)
Option Explicit
Implements IDTExtensibility2

Private Sub IDTExtensibility2_OnAddInsUpdate(custom() As Variant)
End Sub

Private Sub IDTExtensibility2_OnBeginShutdown(custom() As Variant)
End Sub

Private Sub IDTExtensibility2_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
Set xlapp = Application
Set MenuEvents = New ToolsMenuEvents
MenuEvents.CreateMenuItems
End Sub

Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
MenuEvents.DeleteMenuItems
End Sub

Private Sub IDTExtensibility2_OnStartupComplete(custom() As Variant)
End Sub
2013-09-24 07:36
opelwang
Rank: 1
等 级:新手上路
帖 子:78
专家分:3
注 册:2009-7-2
收藏
得分:0 
我更想学习一下,如何自定义图标,敬请高手指点,谢谢.
2013-09-24 09:23
opelwang
Rank: 1
等 级:新手上路
帖 子:78
专家分:3
注 册:2009-7-2
收藏
得分:0 
以下是引用303770957在2013-9-24 14:11:12的发言:

good job!



版主,我的问题还未解决哩....
2013-09-24 18:21
快速回复:用VB6制作Excel2003自定义菜单
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.036538 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved