Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4341322
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:28:09+00:00 2026-05-21T11:28:09+00:00

I’m trying to find a way to get mail attachments (programaticaly) , and then

  • 0

I’m trying to find a way to get mail attachments (programaticaly) , and then open it… can someone tell me how to do this or point me to a right direction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T11:28:10+00:00Added an answer on May 21, 2026 at 11:28 am

    This is a VBA script (use in a Macro in Outlook) which will loop over all attachments in all selected items in the current folder and Save them to disk.

    It should get you started and I don’t think it would take much to add some kind of process launch rather than save logic to it.

     Public Sub SaveAttachments()
    
      'Note, this assumes you are in the a folder with e-mail messages when you run it.
      'It does not have to be the inbox, simply any folder with e-mail messages
    
      Dim Exp As Outlook.Explorer
      Dim Sel As Outlook.Selection
    
      Dim AttachmentCnt As Integer
      Dim AttTotal As Integer
      Dim MsgTotal As Integer
    
      Dim outputDir As String
      Dim outputFile As String
      Dim fileExists As Boolean
      Dim cnt As Integer
    
      'Requires reference to Microsoft Scripting Runtime (SCRRUN.DLL)
      Dim fso As FileSystemObject
    
      Set Exp = Application.ActiveExplorer
    
      Set Sel = Exp.Selection
      Set fso = New FileSystemObject
    
      outputDir = "C:\Path"
      If outputDir = "" Then
        MsgBox "You must pick an directory to save your files to. Exiting SaveAttachments.", vbCritical, "SaveAttachments"
        Exit Sub
      End If
    
       Dim att As Attachment
    
      'Loop thru each selected item in the inbox
      For cnt = 1 To Sel.Count
        'If the e-mail has attachments...
        If Sel.Item(cnt).Attachments.Count > 0 Then
          MsgTotal = MsgTotal + 1
    
          'For each attachment on the message...
          For AttachmentCnt = 1 To Sel.Item(cnt).Attachments.Count
            'Get the attachment
    
            Set att = Sel.Item(cnt).Attachments.Item(AttachmentCnt)
            outputFile = att.FileName
    
            outputFile = Format(Sel.Item(cnt).ReceivedTime, "yyyy-mm-dd_hhmmss - ") + outputFile
    
            fileExists = fso.fileExists(outputDir + outputFile)
    
            'Save it to disk if the file does not exist
            If fileExists = False Then
              att.SaveAsFile (outputDir + outputFile)
              AttTotal = AttTotal + 1
            End If
    
            Set att = Nothing
    
            Sel.Item(cnt).Close (Outlook.OlInspectorClose.olDiscard)
    
          Next
        End If
      Next
    
      'Clean up
      Set Sel = Nothing
      Set Exp = Nothing
      Set fso = Nothing
    
      'Let user know we are done
      Dim doneMsg As String
      doneMsg = "Completed saving " + Format$(AttTotal, "#,0") + " attachments in " + Format$(MsgTotal, "#,0") + " Messages."
      MsgBox doneMsg, vbOKOnly, "Save Attachments"
    
      Exit Sub
    
    ErrorHandler:
    
      Dim errMsg As String
      errMsg = "An error has occurred. Error " + Err.Number + " " + Err.Description
      Dim errResult As VbMsgBoxResult
      errResult = MsgBox(errMsg, vbAbortRetryIgnore, "Error in Save Attachments")
      Select Case errResult
        Case vbAbort
          Exit Sub
    
        Case vbRetry
          Resume
    
        Case vbIgnore
          Resume Next
    
      End Select
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.