Like CLAUSE - Programmers Needed for this one.

  • Thread starter Thread starter Patrick
  • Start date Start date
P

Patrick

This Procedures sends outlook attachments to a directory
based on the subject line from incoming e-mails. However,
is it possible to have those e-mails with subject: AW and
anything thereafter be sent to that directory. Sometimes
the subject changes to: AW (random#).

So I am looking for using something of the LIKE clause in
access, ie LIKE AW*.

Thanks for your help.


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 Att"
Then
If Item.Attachments.Count > 0 Then
Dim objAttachments As Outlook.Attachments
Set objAttachments = Item.Attachments
For Each objAttach In objAttachments
' Does not handle duplicate filename scenarios
objAttach.SaveAsFile "C:\Test\" &
objAttach.FileName
Next
Set objAttachments = Nothing
End If
End If
End Sub
 
You can use the InStr function for that:
If InStr(1, Item.Subject, "AW") > 0 Then
'found
 
Back
Top