S
Steven G
Hi folks!
I've written an COM-Addin in VBA. It worked with Outlook 2000 and XP,
but after updating from Outlook XP to 2003 there's no Addin. No Error
Message or other things happened. Only the Addin wasn't loaded. I've
tested the "OnConnection" Function with a message box but it wasn't
called at the Outlook Start! I deleted the Outlook Addin regkeys at
HKLM\Software\Microsoft\Office\Outlook\Addins\MyAddin.Connect and
HKCU\Software\Microsoft\Office\Outlook\Addins\MyAddin.Connect. Then I
deleted my Addin in Outlook under "Options/COM-Addins" and selected my
Addin dll again. After selecting my Addin was loaded. But after
restarting Outlook no Addin was loaded, although my Addin was listed
under "Options/COM-Addins"
I've checked the disabled elements in Outlook, but there was nothing.
I'm working with Outlook 2003 without SP1 and MacAfee VirusScan
Enterprise 7.1.0.
Any ideas?
Steven
Here is my code:
Connect.dsr:
-------------------------------------------------------------------------------
Option Explicit
Implements IDTExtensibility2
'=============================================================================
'= Private Members
'=============================================================================
' Instance of Base Class, handles all AddIn specific tasks
Private gBaseClass As New OutAddIn
'=============================================================================
'= Properties
'=============================================================================
Public Property Get LocalConnection() As ADODB.Connection
Set LocalConnection = gBaseClass.LocalConnection
End Property
Public Property Get NameSpace() As Outlook.NameSpace
Set NameSpace = gBaseClass.NameSpace
End Property
Public Property Get IsReplicationRunning() As Variant
IsReplicationRunning = gBaseClass.IsReplicationRunning
End Property
'=============================================================================
'= Private Methods
'=============================================================================
Private Sub IDTExtensibility2_OnAddInsUpdate(custom() As Variant)
On Error GoTo ErrHandler
Exit Sub
ErrHandler:
ReportAndLogError Err
End Sub
Private Sub IDTExtensibility2_OnBeginShutdown(custom() As Variant)
On Error GoTo ErrHandler
Exit Sub
ErrHandler:
ReportAndLogError Err
End Sub
Private Sub IDTExtensibility2_OnConnection(ByVal oApplication As
Object, _
ByVal ConnectMode As
AddInDesignerObjects.ext_ConnectMode, _
ByVal oAddInInst As
Object, custom() As Variant)
On Error GoTo ErrHandler
Call gBaseClass.InitHandler(oApplication, oAddInInst.ProgId)
ResHandler:
Exit Sub
ErrHandler:
ReportAndLogError Err
GoTo ResHandler
End Sub
Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As
AddInDesignerObjects.ext_DisconnectMode, _
custom() As Variant)
On Error GoTo ErrHandler
Dim oCommandBar As Office.CommandBar
' If UserClosed, then remove the Items command bar
If RemoveMode = ext_dm_UserClosed Then
Set oCommandBar =
g_OutlookApplication.ActiveExplorer.CommandBars(cCommandBarName)
oCommandBar.Delete
End If
ResHandler:
'Tear down the class
gBaseClass.UnInitHandler
Set gBaseClass = Nothing
Exit Sub
ErrHandler:
ReportAndLogError Err
GoTo ResHandler
End Sub
Private Sub IDTExtensibility2_OnStartupComplete(custom() As Variant)
On Error GoTo ErrHandler
Exit Sub
ErrHandler:
ReportAndLogError Err
End Sub
-------------------------------------------------------------------------------
Here's the OutAddin.InitHandler:
-------------------------------------------------------------------------------
' Iintializes the Add In, creats all nessacary items
Friend Sub InitHandler(olApp As Outlook.Application, strProgID As
String)
On Error GoTo ErrHandler
Dim oNameSpace As Outlook.NameSpace
Dim oDataAccessor As GroupDataAccessor
' Show Start Screen
Load frmStartScreen
frmStartScreen.Show
'Declared WithEvents
Set m_OutlookApplication = olApp
'Instantiate a public module-level Outlook application variable
Set g_OutlookApplication = olApp
' Set Members
m_strAddInProgID = strProgID
Set oNameSpace = m_OutlookApplication.GetNamespace("MAPI")
Set m_OutlookExplorers = m_OutlookApplication.Explorers
' Create a dispatcher for all Item events.
Set m_oDispatcher = New OutlookDispatcher
m_OutlookApplication.COMAddIns.Item(m_strAddInProgID).object =
m_oDispatcher
Set m_oDispatcher.OutlookApplikation = m_OutlookApplication
'Create Replication Manager and init it
Set m_ReplicationManager = New ReplicationManager
Set m_ReplicationManager.OutlookApplikation = m_OutlookApplication
' Set Properties to Replication Manager
Set m_oEnvironment = New AVEnviroment.Enviroment
' Show Ikarus Version in Start Screen
With frmStartScreen
.setHeadline "My Addin"
.Refresh
End With
' Check if Outlook can/may be openend (Create DB Connection)
If Not CheckECInstallation Then
m_OutlookApplication.Quit
GoTo ResumeHandler
End If
' Load Group Cache
Set m_objGroups = New CoreClasses.Groups
Set oDataAccessor = New GroupDataAccessor
Call oDataAccessor.ReadGroups(m_oLocalConnection, m_objGroups)
' and set it to Replication Manager
Set m_ReplicationManager.LocalConnection = m_oLocalConnection
Set m_ReplicationManager.Groups = m_objGroups
' set some information to the Dispatcher, because he must known
the database connection
' and state of replication
Set m_oDispatcher.LocalConnection = Me.LocalConnection
m_oDispatcher.ReplicationRunning = False
Set m_oDispatcher.Groups = m_objGroups
'Only test features and instantiate objects if an Explorer object
exists
If m_OutlookExplorers.Count >= 1 Then
AddExplorer m_OutlookApplication.ActiveExplorer
CBOutlookItems
m_OutlookApplication.ActiveExplorer.CurrentFolder
End If
ResumeHandler:
' Hide Start Screen
frmStartScreen.Hide
Unload frmStartScreen
Set oNameSpace = Nothing
Set oDataAccessor = Nothing
Exit Sub
ErrHandler:
Err.Source = "InitHandler"
ReportAndLogError Err
Resume ResumeHandler
End Sub
-------------------------------------------------------------------------------
I've written an COM-Addin in VBA. It worked with Outlook 2000 and XP,
but after updating from Outlook XP to 2003 there's no Addin. No Error
Message or other things happened. Only the Addin wasn't loaded. I've
tested the "OnConnection" Function with a message box but it wasn't
called at the Outlook Start! I deleted the Outlook Addin regkeys at
HKLM\Software\Microsoft\Office\Outlook\Addins\MyAddin.Connect and
HKCU\Software\Microsoft\Office\Outlook\Addins\MyAddin.Connect. Then I
deleted my Addin in Outlook under "Options/COM-Addins" and selected my
Addin dll again. After selecting my Addin was loaded. But after
restarting Outlook no Addin was loaded, although my Addin was listed
under "Options/COM-Addins"
I've checked the disabled elements in Outlook, but there was nothing.
I'm working with Outlook 2003 without SP1 and MacAfee VirusScan
Enterprise 7.1.0.
Any ideas?
Steven
Here is my code:
Connect.dsr:
-------------------------------------------------------------------------------
Option Explicit
Implements IDTExtensibility2
'=============================================================================
'= Private Members
'=============================================================================
' Instance of Base Class, handles all AddIn specific tasks
Private gBaseClass As New OutAddIn
'=============================================================================
'= Properties
'=============================================================================
Public Property Get LocalConnection() As ADODB.Connection
Set LocalConnection = gBaseClass.LocalConnection
End Property
Public Property Get NameSpace() As Outlook.NameSpace
Set NameSpace = gBaseClass.NameSpace
End Property
Public Property Get IsReplicationRunning() As Variant
IsReplicationRunning = gBaseClass.IsReplicationRunning
End Property
'=============================================================================
'= Private Methods
'=============================================================================
Private Sub IDTExtensibility2_OnAddInsUpdate(custom() As Variant)
On Error GoTo ErrHandler
Exit Sub
ErrHandler:
ReportAndLogError Err
End Sub
Private Sub IDTExtensibility2_OnBeginShutdown(custom() As Variant)
On Error GoTo ErrHandler
Exit Sub
ErrHandler:
ReportAndLogError Err
End Sub
Private Sub IDTExtensibility2_OnConnection(ByVal oApplication As
Object, _
ByVal ConnectMode As
AddInDesignerObjects.ext_ConnectMode, _
ByVal oAddInInst As
Object, custom() As Variant)
On Error GoTo ErrHandler
Call gBaseClass.InitHandler(oApplication, oAddInInst.ProgId)
ResHandler:
Exit Sub
ErrHandler:
ReportAndLogError Err
GoTo ResHandler
End Sub
Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As
AddInDesignerObjects.ext_DisconnectMode, _
custom() As Variant)
On Error GoTo ErrHandler
Dim oCommandBar As Office.CommandBar
' If UserClosed, then remove the Items command bar
If RemoveMode = ext_dm_UserClosed Then
Set oCommandBar =
g_OutlookApplication.ActiveExplorer.CommandBars(cCommandBarName)
oCommandBar.Delete
End If
ResHandler:
'Tear down the class
gBaseClass.UnInitHandler
Set gBaseClass = Nothing
Exit Sub
ErrHandler:
ReportAndLogError Err
GoTo ResHandler
End Sub
Private Sub IDTExtensibility2_OnStartupComplete(custom() As Variant)
On Error GoTo ErrHandler
Exit Sub
ErrHandler:
ReportAndLogError Err
End Sub
-------------------------------------------------------------------------------
Here's the OutAddin.InitHandler:
-------------------------------------------------------------------------------
' Iintializes the Add In, creats all nessacary items
Friend Sub InitHandler(olApp As Outlook.Application, strProgID As
String)
On Error GoTo ErrHandler
Dim oNameSpace As Outlook.NameSpace
Dim oDataAccessor As GroupDataAccessor
' Show Start Screen
Load frmStartScreen
frmStartScreen.Show
'Declared WithEvents
Set m_OutlookApplication = olApp
'Instantiate a public module-level Outlook application variable
Set g_OutlookApplication = olApp
' Set Members
m_strAddInProgID = strProgID
Set oNameSpace = m_OutlookApplication.GetNamespace("MAPI")
Set m_OutlookExplorers = m_OutlookApplication.Explorers
' Create a dispatcher for all Item events.
Set m_oDispatcher = New OutlookDispatcher
m_OutlookApplication.COMAddIns.Item(m_strAddInProgID).object =
m_oDispatcher
Set m_oDispatcher.OutlookApplikation = m_OutlookApplication
'Create Replication Manager and init it
Set m_ReplicationManager = New ReplicationManager
Set m_ReplicationManager.OutlookApplikation = m_OutlookApplication
' Set Properties to Replication Manager
Set m_oEnvironment = New AVEnviroment.Enviroment
' Show Ikarus Version in Start Screen
With frmStartScreen
.setHeadline "My Addin"
.Refresh
End With
' Check if Outlook can/may be openend (Create DB Connection)
If Not CheckECInstallation Then
m_OutlookApplication.Quit
GoTo ResumeHandler
End If
' Load Group Cache
Set m_objGroups = New CoreClasses.Groups
Set oDataAccessor = New GroupDataAccessor
Call oDataAccessor.ReadGroups(m_oLocalConnection, m_objGroups)
' and set it to Replication Manager
Set m_ReplicationManager.LocalConnection = m_oLocalConnection
Set m_ReplicationManager.Groups = m_objGroups
' set some information to the Dispatcher, because he must known
the database connection
' and state of replication
Set m_oDispatcher.LocalConnection = Me.LocalConnection
m_oDispatcher.ReplicationRunning = False
Set m_oDispatcher.Groups = m_objGroups
'Only test features and instantiate objects if an Explorer object
exists
If m_OutlookExplorers.Count >= 1 Then
AddExplorer m_OutlookApplication.ActiveExplorer
CBOutlookItems
m_OutlookApplication.ActiveExplorer.CurrentFolder
End If
ResumeHandler:
' Hide Start Screen
frmStartScreen.Hide
Unload frmStartScreen
Set oNameSpace = Nothing
Set oDataAccessor = Nothing
Exit Sub
ErrHandler:
Err.Source = "InitHandler"
ReportAndLogError Err
Resume ResumeHandler
End Sub
-------------------------------------------------------------------------------