Easily upload multiple users’ photos to Office 365. Manage them with an intuitive GUI and use handy built-in cropping and resizing options. Link photos with users based on Azure AD attributes. Free tool!
Private WithEvents objInboxItems As Items Private Sub Application_Startup() Dim objNS As NameSpace Set objNS = Application.GetNamespace("MAPI") ' instantiate Items collections for folders we want to monitor Set objInboxItems = objNS.GetDefaultFolder(olFolderInbox).Items Set MyInbox = objNS.GetDefaultFolder(olFolderInbox) Set objNS = Nothing End Sub Private Sub Application_Quit() ' disassociate global objects declared WithEvents Set objInboxItems = Nothing End Sub Private Sub objInboxItems_ItemAdd(ByVal Item As Object) Dim olItems As Items, _ olItem As Object, _ olMailItem As MailItem, _ olAttachmentItem As Attachment, _ strInvoice As String, _ strFileName As String Set olItems = objInboxItems.Restrict("[Unread] = True") For Each olItem In olItems If olItem.Class = olMail Then Set olMailItem = olItem 'Selected based on the subject you want to key on If InStr(1, olMailItem.Subject, "Eriksen | Invoice #", vbTextCompare) > 0 Then If olMailItem.Attachments.Count > 0 Then strInvoice = Right(olItem, 6) For Each olAttachmentItem In olMailItem.Attachments strFileName = "Eriksen_Invoice_" & strInvoice 'Change the path on the next line to the path you want to save your attachments in olAttachmentItem.SaveAsFile "H:\My Documents\3_Purchase_Card\TransactionsFY2016\Eriksen_Translations\" & strFileName & ".pdf" olItem.UnRead = False Next End If End If End If Next End Sub
Join the community of 500,000 technology professionals and ask your questions.