Hi,
If someone could figure out what's wrong with the below WithEvents that it does not fire with new email.
If someone could figure out what's wrong with the below WithEvents that it does not fire with new email.
Code:
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim appOl As Outlook.Application
Dim ns As Outlook.NameSpace
Set appOl = Outlook.Application
Set ns = appOl.GetNamespace("MAPI")
Set Items = ns.GetDefaultFolder(olFolderInbox).Folders("Personal Mail").Items
End Sub
Private Sub Items_ItemAdd(ByVal item As Object)
On Error GoTo GetAttachments_err
Dim appOl As New Outlook.Application
Dim ns As Outlook.NameSpace
Dim Inbox As Outlook.MAPIFolder
Dim myDestFolder As Outlook.MAPIFolder
Dim item As Object
Dim Atmt As Outlook.Attachment
Dim FileName As String
Dim i As Integer
Dim iLoop As Integer
Dim Items As Outlook.Items
Dim moveEmail As Boolean
Set ns = appOl.GetNamespace("MAPI")
Set Inbox = ns.GetDefaultFolder(olFolderInbox)
Set item = Inbox.Items
Set myDestFolder = Inbox.Folders("Personal Mail")