Private Function GetProjectOfComponent(ByRef vbc As VBIDE.VBComponent) As VBIDE.VBProject
Dim p As VBProject
Dim c As VBComponent
Set GetProjectOfComponent = Nothing
For Each p In gVBE.VBProjects
For Each c In p.VBComponents
If c Is vbc Then
Set GetProjectOfComponent = p
Exit Function
End If
Next
Next
End Function
Private Sub CmpHandler_ItemActivated(ByVal VBComponent As VBIDE.VBComponent)
' Debug.Print "CmpHandler", "Activated"
End Sub
Private Sub CmpHandler_ItemAdded(ByVal VBComponent As VBIDE.VBComponent)
'
'For Each p In gVBE.VBProjects
' For Each c In p.VBComponents
Dim p As VBProject
Set p = GetProjectOfComponent(VBComponent)
If Not Nothing Is p Then
AddButton p, VBComponent
End If
End Sub
Private Sub CmpHandler_ItemReloaded(ByVal VBComponent As VBIDE.VBComponent)
'
End Sub
Private Sub CmpHandler_ItemRemoved(ByVal VBComponent As VBIDE.VBComponent)
Debug.Print "CmpHandler", "Removed"
Debug.Print "Is removed ", VBComponent.Name
' vbcomponent.
Dim ocbcTemp As Office.CommandBarControl
Dim s As String
Dim p As VBProject
Set p = GetProjectOfComponent(VBComponent)
If Not Nothing Is p Then
s = p.Name & "." & VBComponent.Name
For Each ocbcTemp In gVBE.CommandBars("VBgamer").Controls
If ocbcTemp.OnAction = s Then ocbcTemp.Delete: Exit For
Next
End If
End Sub
Private Sub CmpHandler_ItemRenamed(ByVal VBComponent As VBIDE.VBComponent, ByVal OldName As String)
RefreshToolbar
End Sub
Private Sub CmpHandler_ItemSelected(ByVal VBComponent As VBIDE.VBComponent)
' Debug.Print "CMPHandler", "Item Selected"
End Sub
Private Sub IDTExtensibility_OnAddInsUpdate(custom() As Variant)
'' Comment to prevent procedure from being
'' deleted on compilation.
End Sub
Private Sub IDTExtensibility_OnConnection(ByVal VBInst As Object, ByVal ConnectMode As VBIDE.vbext_ConnectMode, ByVal AddInInst As VBIDE.AddIn, custom() As Variant)
'
'MsgBox "Add-in is now connected"
Set gVBE = VBInst
Set EvtHandlers = New Collection
'Dim docTabOrderObject As Object 'user doc instance