+ Reply to Thread
Results 1 to 2 of 2

VBA - To save attachment from email to folder

  1. #1
    Registered User
    Join Date
    11-27-2016
    Location
    [email protected]
    MS-Off Ver
    2016
    Posts
    1

    Question VBA - To save attachment from email to folder

    hi,

    I want to find the way to save emails from outlook to specific location in drive which varies by month.

    My intension is to save the file directly to folders (that existed) by months (if the email received on Dec, it will saved directly to Dec folder) rather than one specific folder.

    Current code

    Public Sub Save1(itm As Outlook.MailItem)
    Dim objAtt As Outlook.Attachment
    Dim saveFolder As String
    saveFolder = "C:\Users\narindran\Documents\"
    For Each objAtt In itm.Attachments
    objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
    Set objAtt = Nothing
    Next
    End Sub


    Appreciate for your help.

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: VBA - To save attachment from email to folder

    Hi
    if your directories follow a logical sequence based on month names, e.g. C:\Users\narindran\Documents\Jan\, you could try something like this:

    Please Login or Register  to view this content.
    Last edited by NickyC; 11-28-2016 at 02:17 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to get outlook email attachment using excel vba and save it in a specified folder
    By jrtraylor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-25-2016, 08:34 PM
  2. Find PDF in Folder based on cell value and add as attachment to email and send
    By sintek in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-23-2016, 03:51 AM
  3. Save an Outlook attachment and move the email to a folder based and sender
    By db16886 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-24-2014, 09:49 PM
  4. Dowload outlook email attachment to my pc folder using Excel VBA
    By din.malay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-11-2013, 08:06 AM
  5. Dowload outlook email attachment to my pc folder
    By din.malay in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 12-11-2013, 03:34 AM
  6. auto save e-mail attachment to folder after sending
    By ncaravela in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-16-2010, 05:23 PM
  7. Improve Macro to Save Attachment to Folder
    By adammark in forum Outlook Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2010, 08:18 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1