R
Randy Lane
The following code worked flawlessly for ages on a Windows NT 4 Server
with Outlook 2000 accessing Exchange 5.5.
I recently installed Outlook 2002 on a Windows 2003 Server and copied
the macro. Now I get this wierd error all the time :
Method 'Class' of Objject 'MailItem' Failed
The error occurs on the last line of the code below. And idea what's
causing this?
Option Explicit
Private WithEvents oInboxItems As Items
Private Sub Application_Startup()
Dim oNS As NameSpace
Set oNS = Application.GetNamespace("MAPI")
Set oInboxItems = oNS.GetDefaultFolder(olFolderInbox).Items
Set oNS = Nothing
End Sub
Private Sub oInboxItems_ItemAdd(ByVal Item As Object)
Dim oApp As Application
Dim oNS As NameSpace
Dim oAttachments As Attachments
Dim oAttachedFile As Attachment
Dim oSNCFolder As MAPIFolder
Dim oSafeMail As Redemption.SafeMailItem
Dim oFilename As String
Dim oSaveAsName As String
Set oApp = Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
Set oSNCFolder = oNS.Folders("SqlAdmin").Folders("State National
Autobill")
If Item.Class = olMail Then
with Outlook 2000 accessing Exchange 5.5.
I recently installed Outlook 2002 on a Windows 2003 Server and copied
the macro. Now I get this wierd error all the time :
Method 'Class' of Objject 'MailItem' Failed
The error occurs on the last line of the code below. And idea what's
causing this?
Option Explicit
Private WithEvents oInboxItems As Items
Private Sub Application_Startup()
Dim oNS As NameSpace
Set oNS = Application.GetNamespace("MAPI")
Set oInboxItems = oNS.GetDefaultFolder(olFolderInbox).Items
Set oNS = Nothing
End Sub
Private Sub oInboxItems_ItemAdd(ByVal Item As Object)
Dim oApp As Application
Dim oNS As NameSpace
Dim oAttachments As Attachments
Dim oAttachedFile As Attachment
Dim oSNCFolder As MAPIFolder
Dim oSafeMail As Redemption.SafeMailItem
Dim oFilename As String
Dim oSaveAsName As String
Set oApp = Outlook.Application
Set oNS = oApp.GetNamespace("MAPI")
Set oSNCFolder = oNS.Folders("SqlAdmin").Folders("State National
Autobill")
If Item.Class = olMail Then