S
SGreville
Hello
I have some code to run at the start of Outlook to initiate the item add
event handler.
However the code in the Application_Startup does not fire.
The macro security is set to low and the application_quit procedure fires
when i exit outlook if i have opend the VBA window before closing.
I am running in Outlook 2000 SP3 through citrix server, however i have
encountered the same problem on a standard windows 2000 client.
Here is the code
Option Explicit
Private WithEvents olInboxItems As Items
Private Sub Application_Quit()
' disassociate global objects
Set olInboxItems = Nothing
MsgBox "Bye Bye", vbInformation ' this fires if the code window has been
opened before closing outlook.
End Sub
Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set olInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
Set objNS = Nothing
Application.ActiveExplorer.WindowState = olMaximized
MsgBox ("Startup") ' Just to see if the procedure is firing.
End Sub
Private Sub olInboxItems_ItemAdd(ByVal Item As Object)
' this procedure works fine once event is initialised
End Sub
Many thanks in advance
Stuart
I have some code to run at the start of Outlook to initiate the item add
event handler.
However the code in the Application_Startup does not fire.
The macro security is set to low and the application_quit procedure fires
when i exit outlook if i have opend the VBA window before closing.
I am running in Outlook 2000 SP3 through citrix server, however i have
encountered the same problem on a standard windows 2000 client.
Here is the code
Option Explicit
Private WithEvents olInboxItems As Items
Private Sub Application_Quit()
' disassociate global objects
Set olInboxItems = Nothing
MsgBox "Bye Bye", vbInformation ' this fires if the code window has been
opened before closing outlook.
End Sub
Private Sub Application_Startup()
Dim objNS As NameSpace
Set objNS = Application.GetNamespace("MAPI")
Set olInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items
Set objNS = Nothing
Application.ActiveExplorer.WindowState = olMaximized
MsgBox ("Startup") ' Just to see if the procedure is firing.
End Sub
Private Sub olInboxItems_ItemAdd(ByVal Item As Object)
' this procedure works fine once event is initialised
End Sub
Many thanks in advance
Stuart