Like CLAUSE - Programmers Needed for this one.

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
 
K

Ken Slovak - [MVP - Outlook]

You can use the InStr function for that:
If InStr(1, Item.Subject, "AW") > 0 Then
'found
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top