{"id":2412,"date":"2023-01-31T14:42:29","date_gmt":"2023-01-31T12:42:29","guid":{"rendered":"https:\/\/itsimple.info\/?p=2412"},"modified":"2023-01-31T14:42:31","modified_gmt":"2023-01-31T12:42:31","slug":"how-to-save-attachments-from-multiple-emails-to-folder-in-outlook","status":"publish","type":"post","link":"https:\/\/itsimple.info\/?p=2412","title":{"rendered":"How To save attachments from multiple emails To Folder in outlook"},"content":{"rendered":"\n<p>if you want to save all the attachments from multiple emails you can do it from outlook VBA code in <strong>Microsoft Visual Basic for Applications<\/strong> window in outlook, First lets create a folder, in this example you need to open a folder under &#8220;My Documents&#8221; call attachments<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"673\" height=\"415\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2023\/01\/image.png\" alt=\"\" class=\"wp-image-2413\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2023\/01\/image.png 673w, https:\/\/itsimple.info\/wp-content\/uploads\/2023\/01\/image-300x185.png 300w\" sizes=\"auto, (max-width: 673px) 100vw, 673px\" \/><\/figure>\n\n\n\n<p>Then, in outlook type <strong>Alt<\/strong> + <strong>F11<\/strong> keys to open the <strong>Microsoft Visual Basic for Applications<\/strong> window . insert new module and paste this code in :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Public Sub SaveAttachments()\n'Update 20200821\nDim xMailItem As Outlook.MailItem\nDim xAttachments As Outlook.Attachments\nDim xSelection As Outlook.Selection\nDim i As Long\nDim xAttCount As Long\nDim xFilePath As String, xFolderPath As String, xSaveFiles As String\nDim xYesNo As Integer\nDim xFlag As Boolean\nOn Error Resume Next\nxFolderPath = CreateObject(\"WScript.Shell\").SpecialFolders(16)\nSet xSelection = Outlook.Application.ActiveExplorer.Selection\nxFolderPath = xFolderPath &amp; \"\\Attachments\\\"\nIf VBA.Dir(xFolderPath, vbDirectory) = vbNullString Then\n    VBA.MkDir xFolderPath\nEnd If\nFor Each xMailItem In xSelection\n    Set xAttachments = xMailItem.Attachments\n    xAttCount = xAttachments.Count\n    xSaveFiles = \"\"\n    If xAttCount > 0 Then\n        For i = xAttCount To 1 Step -1\n            xFilePath = xFolderPath &amp; xAttachments.Item(i).FileName\n            xFlag = True\n            If VBA.Dir(xFilePath, 16) &lt;> Empty Then\n                xYesNo = MsgBox(\"The file is exists, do you want to replace it\", vbYesNo + vbInformation, \"Kutools for Outlook\")\n                If xYesNo = vbNo Then xFlag = False\n            End If\n            If xFlag = True Then\n                xAttachments.Item(i).SaveAsFile xFilePath\n                If xMailItem.BodyFormat &lt;> olFormatHTML Then\n                    xSaveFiles = xSaveFiles &amp; vbCrLf &amp; \"&lt;Error! Hyperlink reference not valid.>\"\n                Else\n                    xSaveFiles = xSaveFiles &amp; \"&lt;br>\" &amp; \"&lt;a href='file:\/\/\" &amp; xFilePath &amp; \"'>\" &amp; xFilePath &amp; \"&lt;\/a>\"\n                End If\n            End If\n        Next i\n    End If\nNext\nSet xAttachments = Nothing\nSet xMailItem = Nothing\nSet xSelection = Nothing\nEnd Sub<\/code><\/pre>\n\n\n\n<p>Highlight the email you want to extract the attachments from and run the script with F5<\/p>\n\n\n\n<p>You will have all the attachments saved to the folder<\/p>\n\n\n\n<figure class=\"wp-block-pullquote has-vivid-green-cyan-color has-text-color has-medium-font-size\"><blockquote><p>Good Luck<\/p><\/blockquote><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>if you want to save all the attachments from multiple emails you can do it from outlook VBA code in Microsoft Visual Basic for Applications window in outlook, First lets create a folder, in this example you need to open a folder under &#8220;My Documents&#8221; call attachments Then, in outlook type Alt + F11 keys [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9,23,4,12,14],"tags":[],"class_list":["post-2412","post","type-post","status-publish","format-standard","hentry","category-microsoft-exchange-2016","category-office-365","category-tech","category-tutorials","category-windows"],"_links":{"self":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/2412","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2412"}],"version-history":[{"count":0,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/2412\/revisions"}],"wp:attachment":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}