Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.
Public Sub SaveSelectedAttachments() On Error GoTo ErrorHandler Dim olns As Outlook.NameSpace Dim objMsg As Object Dim objAttachments As Outlook.Attachments Dim objSelectedItems As Outlook.Selection Dim f, i, j, k, counter As Integer Dim attPath, attFileName As String, strDesktop As String, strR As String Set olns = Application.GetNamespace("MAPI") Set objSelectedItems = olns.Application.ActiveExplorer.Selection strDesktop = "C:\Users\Jbryan\Desktop\SavedPDFS" msgfolder = strDesktop For Each objMsg In objSelectedItems k = k + 1 j = 0 If objMsg.Class = olMail Then Set objAttachments = objMsg.Attachments counter = objAttachments.Count If counter > 0 Then With objMsg strR = Format(.ReceivedTime, "Short Date") End With strR = Replace(strR, "/", "-", 1) For i = objAttachments.Count To 1 Step -1 j = j + 1 f = f + 1 iExt = Len(objAttachments.Item(i).FileName) - InStrRev(objAttachments.Item(i).FileName, ".") strE = Right(objAttachments.Item(i).FileName, iExt) attFileName = Left(objAttachments.Item(i).FileName, Len(objAttachments.Item(i).FileName) - iExt - 1) attFileName = strR & "_" & k & "_" & j & ".pdf" attPath = msgfolder & "\" & attFileName objAttachments.Item(i).SaveAsFile attPath Next i End If End If Next objMsg ExitSub: Set objAttachments = Nothing Set objMsg = Nothing Set objSelectedItems = Nothing Set olns = Nothing MsgBox "Attachments have been successfully saved." Exit Sub ErrorHandler: MsgBox "Saveattachments( ) Subroutine" & vbCrLf & vbCrLf & "Error Code: " & Err.Number & vbCrLf & Err.Description Err.Clear GoTo ExitSub End Sub
|Which version of Microsoft Project does my client need?||3||18|
|Why cant I receive emails from .mil addresses?||17||52|
|How to back up outlook 2016 emails that are stored in the server as archive?||7||30|
|how can I correct in impaired MS Word 2013 invoice template print out?||7||11|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
17 Experts available now in Live!