VB6,如何制作COM加载项或者外接程序给Excel的VBE添加右键菜单
VB6,怎么制作COM加载项或者外接程序给Excel的VBE添加右键菜单?
最近想给Excel的 VBE 添加右键菜单。尝试了下面两段代码,无法实现。
代码一:
代码二:
调试:
错误 1004 ,不信任到 visual basic project 的程序连接。(excel 已勾选 “对VB项目的信任”)
环境:Excel 2003 。
在excel 2010 或者 word 2003 下面都可以实现,唯独 excel2003 不行。
excel 2010下的效果图:
最近想给Excel的 VBE 添加右键菜单。尝试了下面两段代码,无法实现。
代码一:
Implements IDTExtensibility2
Dim ExApp As Excel.Application
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 ExApp = Application
End Sub
Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
Set ExApp = Nothing
End Sub
Private Sub IDTExtensibility2_OnStartupComplete(custom() As Variant)
On Error Resume Next
ExApp.VBE.CommandBars("code window").Controls.Add(10, , , 1).Caption = "TEST"
End Sub
代码二:
Dim ExApp As Excel.Application
Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
Set ExApp = Application
End Sub
Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant)
Set ExApp = Nothing
End Sub
Private Sub AddinInstance_OnStartupComplete(custom() As Variant)
ExApp.VBE.CommandBars("code window").Controls.Add(10, , , 1).Caption = "TEST"
End Sub
调试:
错误 1004 ,不信任到 visual basic project 的程序连接。(excel 已勾选 “对VB项目的信任”)
环境:Excel 2003 。
在excel 2010 或者 word 2003 下面都可以实现,唯独 excel2003 不行。
excel 2010下的效果图:
VB6
COM加载项
外接程序
VBE右键菜单
IDTExtensibility2
- 1VB 新人flexgrid 下拉内容有关问题
- 2vb.net中对exel用查询语句查询时,是否只识别 "select * from [Sheet1$]" 这一条语句啊
- 3vba示意颜色值的数据是什么类型?这种形式 &H000000FF&
- 4怎么使用NET Reactor为您的.Net(C#VB.Net) 源代码加密
- 5怎么用代码判断ACCESS数据库中A表中B字段的类型是否为long型,如果是,则改为double型
- 6手把手教你VB.NET七层设计思路(1)
- 7不同网段怎么连接SqlServer2000
- 8WORD VBA有关问题求教
- 9怎么在程序代码中加载主窗体的ICO,在网上查了些资料,但没找到,麻烦大家了
- 10vb6.0 Do While Loop读取文件,本行不符合条件,跳出本次循环,进来下一行循环
文章评论
相关解决方案