I have some code that will scan the inbox of my outlook for a certain phrase in the subject. What i havent been able to figure out is how to save attachments to a specific location. Below is my current code. I need it to read a specific line off the subject and to read the body. Both of those I have working. If you feel that I have done something wrong please feel free to let me know.
Code:
Private Sub Form_Load()
Dim objInboxFolders As Object, strFolder As String
Set MyOutlook = New Outlook.Application
With MyOutlook.GetNamespace("MAPI")
For f = 1 To .GetDefaultFolder(olFolderInbox).Folders.Count
If .GetDefaultFolder(olFolderInbox).Folders.Item(f).Name = "Diagnostic" Then
strFolder = .GetDefaultFolder(olFolderInbox).Folders.Item(f).EntryID
'MsgBox strFolder
Exit For
End If
Next f
End With
End Sub
Private Sub tmrScan_Timer()
Dim objMessage As Object
For Each objMessage In .GetDefaultFolder(olFolderInbox).Items
'MsgBox objMessage.Body
If Left(objMessage, 12) = "[Diagnostic]" Then
objMessage.MoveTo strFolder
End If
Next
End Sub