Results 1 to 2 of 2
  1. #1
    Baz16 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    11

    Automationg the opening of an outlook e-mail attachment and saving using vba in excel

    Hi, I receive a excel file each date, the title name is the same except ends with the report date and the subject title of the e-mail is the same as the excel report name

    I am looking to automate the opening and saving of the attachment,

    I have so far managed to get the correct e-mail to open (please see below), but cannot seem to find anywhere how to save the document to shared drive,


    The share drive being \\ntfiler01\reports\.

    I would Like this to happen from an excel sheet as well as I have automated the refreshing of the report, the only thing I have not automated is the above.

    Is there anyone who knows the correct VBA to save an attachment one the correct e-mail is open.
    ReportDate= Format(Date - 1, "DD.MM.YYYY")
    SubjectName= "Daily Report" & ReportDate

    Dim olNs As Namespace
    Dim Fldr As MAPIFolder
    Dim olMail As Variant
    'Dim objAttachments As Outlook.Attachments
    Dim i As Integer
    Set olApp = New Outlook.Application
    Set olNs = olApp.GetNamespace("MAPI")
    Set Fldr = olNs.GetDefaultFolder(olFolderInbox)
    i = 1
    For Each olMail In Fldr.Items
    If InStr(olMail.Subject, SubjectName) <> 0 Then
    olMail.Display
    i = i + 1
    End If
    Next olMail

    End Sub

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    See if the "Saving an email attachment" code here helps you. It got me started:

    http://www.thatlldoit.com/Pages/howtosarticles.aspx
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 08-11-2014, 12:57 PM
  2. saving data from Attachment field to local drive
    By saleemsadique in forum Access
    Replies: 5
    Last Post: 01-21-2014, 06:52 PM
  3. Excel attachment and save as draft in outlook
    By ragsgold in forum Programming
    Replies: 1
    Last Post: 02-01-2013, 05:55 PM
  4. How to e-mail from access to outlook
    By hogue@montana.com in forum Programming
    Replies: 5
    Last Post: 02-17-2012, 12:33 PM
  5. Old way: Outlook...New way: Google mail
    By pdx834 in forum Access
    Replies: 1
    Last Post: 03-08-2011, 04:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums