Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.
Sub SaveOutlookAttachments(olkMessage As Outlook.MailItem) Dim olkAttachment As Outlook.Attachment, _ objFSO As Object, _ strRootFolderPath As String, _ strFilename As String 'Path for where to save attachments strRootFolderPath = "X:\sh_fox\FIR_TBT\2011\2011_ExceptionReports\2011_March\3-7-2011\" Set objFSO = CreateObject("Scripting.FileSystemObject") Set olkSourceFolder = Application.ActiveExplorer.CurrentFolder If olkMessage.Attachments.Count > 0 Then For Each olkAttachment In olkMessage.Attachments strFilename = olkAttachment.FileName intCount = 0 Do While True If objFSO.FileExists(strRootFolderPath & strFilename) Then intCount = intCount + 1 strFilename = "Copy (" & intCount & ") of " & olkAttachment.FileName Else Exit Do End If Loop olkAttachment.SaveAsFile strRootFolderPath & strFilename Next End If Set objFSO = Nothing Set olkAttachment = Nothing Set olkMessage = Nothing End Sub
|Macro to Send Appointment from Excel||1||31|
|EXCEL Addin problem||7||27|
|In Excel 2007, why do the text in a cell keep changing each time I have restarted Excel?||9||31|
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
15 Experts available now in Live!