Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
Sub SaveAttachments() Dim olkSelectedItems As Object, _ olkItem As Object, _ objFile As Object, _ objDict As Object, _ strFilename As String, _ arrLines As Variant, _ varName As Variant, _ varTemp As Variant strFilename = "" Set olkSelectedItems = Application.ActiveExplorer.Selection For Each olkItem In olkSelectedItems Set objDict = CreateObject("Scripting.Dictionary") If olkItem.Attachments.Count > 0 Then arrLines = Split(olkItem.Body, vbCrLf) For Each varName In arrLines varTemp = Trim(varName) If Left(varTemp, 1) = "*" Then If Not objDict.Exists(varTemp) Then objDict.Add Mid(varTemp, 2), Mid(varTemp, 2) End If End If Next arrLines = objDict.Items() For Each objFile In olkItem.Attachments For Each varName In arrLines strFilename = "c:\OutlookTemp\" & varName objFile.SaveAsFile strFilename Next Next End If Next Set objDict = Nothing Set objFile = Nothing Set olkItem = Nothing Set olkSelectedItems = Nothing End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.