|
'------------------------------------------------------
'这个方法添加外接程序到 VB
'------------------------------------------------------
Private Sub AddinInstance_OnConnection(ByVal Application As Object, ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, ByVal AddInInst As Object, custom() As Variant)
On Error GoTo error_handler
MsgBox "这里是打开VBA时加载"
'保存 vb 实例
Set VBInstance = Application
'这里是一个设置断点以及测试不同外接程序
'对象,属性及方法的适当位置
Debug.Print VBInstance.FullName
MsgBox VBInstance.FullName
If ConnectMode = ext_cm_External Then
'用于让向导工具栏来启动此向导
Me.Show
Else
Set mcbMenuCommandBar = AddToAddInCommandBar("关于我们")
'吸取事件
Set Me.MenuHandler = VBInstance.Events.CommandBarEvents(mcbMenuCommandBar)
End If
If ConnectMode = ext_cm_AfterStartup Then
If GetSetting(app.Title, "Settings", "DisplayOnConnect", "0") = "1" Then
'设置这个到连接显示的窗体
Me.Show
End If
End If
Exit Sub
error_handler:
MsgBox Err.Description
End Sub
在vba7.1 中为什么会无效? |
|