+ Reply to Thread
Results 1 to 1 of 1

Download Atatchment based on sender and time received

  1. #1
    Registered User
    Join Date
    01-22-2014
    Location
    Amsterdam
    MS-Off Ver
    Excel 2003
    Posts
    1

    Question Download Atatchment based on sender and time received

    Good afternoon all,

    Currently, I receive a lot of daily emails in a subfolder. As part of a daily backup file, I would like to save an attachment that was send yesterday (t-1), from an email with a specific subject.

    The macro does save the attachment. However, it keeps on running for ages. I am not sure how to kill the macro as soon it saved the attachment from t-1.

    So my question: How do I save an attachment from from an email in outlook, with a specific subject and specific time restriction.

    I am looking forward to your input. See below code that I made this far.

    Regards,

    T
    Sub SaveAtt()

    Dim ns As Namespace
    Dim Inbox As MAPIFolder
    Dim Item As Object
    Dim Att As Attachment
    Dim Path As String
    Dim Name As String
    Dim Vdate As String
    Dim i As Integer

    Sheets("Summary").Select
    Vdate = Format(Range("B3").Value, "m/dd/yyyy h:mm AM/PM") '''''''''''''''''''Range("B3")=workday(today,-1)
    Path = ThisWorkbook.Path & "\"

    Set ns = GetNamespace("MAPI")
    Set Inbox = ns.GetDefaultFolder(olFolderInbox)
    Set PricingInbox = ns.Folders("Price")
    Set Pi = PricingInbox.Folders("Inbox")
    Set V = PricingInbox.Folders("V")

    For Each Item In V.Items

    Set objsubject = V.Items.Find("[Subject] = ""Today's File""")
    Set objsubject2 = V.Items.Restrict("[lastModificationTime]> Vdate")

    If Item.Subject = "x" Then
    Set Att = objsubject.Attachments
    DateStamp = Item.LastModificationTime

    Att(1).FileName
    FileName = Path & Att(1).FileName
    Att(1).SaveAsFile FileName

    End If


    Next

    i = 0


    End Sub
    This one has been solved.
    Last edited by tanvo; 02-11-2014 at 04:22 AM. Reason: This request has been solved

+ 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. Lookup to calculate Unit most likely associated based on time received
    By Viking87 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2013, 12:34 PM
  2. Calculating workdays based on date/time received
    By Sharv103 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-18-2013, 08:46 PM
  3. Improvement - Show ALL THREADS which received Rep in Latest Reputation Received Area
    By :) Sixthsense :) in forum Suggestions for Improvement
    Replies: 2
    Last Post: 02-12-2013, 03:27 AM
  4. Calculate ship date based on date and time order is received
    By joekomar in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-23-2013, 10:57 PM
  5. COPY outlook mails subject, received date, sender details in excel
    By Ratnakar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-27-2012, 10:14 AM

Tags for this Thread

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