M
MANDLA MKHWANAZI
How can i check for a certain email if it has an attatchment then save it on
the external drive: i have this code which i did put on the outlook emial
as a mircro but its not working :
Dim WithEvents objInbox As Outlook.Items
Private Sub Application_Startup()
Set objInbox = Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub objInbox_ItemAdd(ByVal item As Object)
If item.Class = olMail And item.Subject = "Test" Then
If item.Attachments.Count > 0 Then
Dim objattachments As Outlook.Attachment
Set objattachments = item.Attachments
For Each objattach In objattachments
objattach.SaveAsFile "c:\test\" & objattach.FileName
Next
Set objattachments = Nothing
End If
End If
End Sub
the external drive: i have this code which i did put on the outlook emial
as a mircro but its not working :
Dim WithEvents objInbox As Outlook.Items
Private Sub Application_Startup()
Set objInbox = Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub objInbox_ItemAdd(ByVal item As Object)
If item.Class = olMail And item.Subject = "Test" Then
If item.Attachments.Count > 0 Then
Dim objattachments As Outlook.Attachment
Set objattachments = item.Attachments
For Each objattach In objattachments
objattach.SaveAsFile "c:\test\" & objattach.FileName
Next
Set objattachments = Nothing
End If
End If
End Sub