Code:
Public VBInstance As VBIDE.VBE
Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long
Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long
Function RemoveAddIn_Self() As Boolean
On Error GoTo err
Dim addIn1 As AddIn
Set addIn1 = VBInstance.Addins("VB6_PackageManager.Connect")
RemoveAddIn_Self = True
Unload frmAddIn
Set VBInstance = Nothing
addIn1.Connect = False
Set addIn1 = Nothing
Dim H As Long
H = LoadLibrary("VB6PackageManager.dll")
If H = 0 Then MsgBox "h0"
FreeLibrary H
Exit Function
err:
MsgBox "err-RemoveAddIn_Self:" & err.Number & "," & err.Description
End Function