+ Reply to Thread
Results 1 to 3 of 3

Outlook 365 Attachment download

  1. #1
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Outlook 365 Attachment download

    Hi All...

    The following code does the extraction of files to the required path...This works in 2013, 2016, 2019
    Does not however work in 365...The code does not even fire...Any ideas???


    Please Login or Register  to view this content.

    I am guessing.....That the default inbox of user is not the actual default inbox?

    I need to extract from the inbox based on specific email...There are multiple...
    K, have managed to get this to work...

    Please Login or Register  to view this content.
    Last edited by sintek; 03-05-2021 at 05:43 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  2. #2
    Registered User
    Join Date
    07-18-2017
    Location
    Manila, Philippines
    MS-Off Ver
    2007
    Posts
    1

    Re: Outlook 365 Attachment download

    Hello,

    Can I get some help in VBA scripts. I want to do an auto save of attachment in Outlook 365 to my network shared folder. Im using the below code: the code works fine but when I open the saved CSV file, it gives me a pop up message "The file format and extension of ************ don't match".

    Public Sub Save_Attachment(itm As Outlook.MailItem)

    On Error Resume Next

    Dim objAtt As Outlook.Attachment
    Dim saveFolder As String
    Dim fname As String

    saveFolder = "C:\Reoprts\Data\Files" ' Change this file path to your folder

    For Each objAtt In itm.Attachments

    posr = InStrRev(objAtt.FileName, ".xlsx")
    ext = Right(objAtt.FileName, Len(objAtt.FileName) - posr)
    posl = InStr(objAtt.FileName, ".")
    fname = Left(objAtt.FileName, posl - 1)

    objAtt.SaveAsFile saveFolder & "\" & itm.Subject & ".csv"

    Set objAtt = Nothing
    Next
    End Sub
    Last edited by laurengambia; 03-12-2021 at 01:10 PM.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,122

    Re: Outlook 365 Attachment download

    laurengambia...
    Your post does not comply with...
    Rule No 2
    2. Programming code must be enclosed in code tags to improve readability. (A, Z)
    Please Login or Register  to view this content.
    (or use the # button)



    Rule No 4...
    4. Do not post a new help request in an existing thread.

+ 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. Outlook an email with .xls attachment, download and open Workbook
    By lougs7 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-09-2020, 08:32 PM
  2. [SOLVED] download attachment from outlook to PC for a specific date, file etc
    By emmr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2019, 05:51 AM
  3. Download Excel attachment from Outlook
    By E5254730 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-28-2017, 09:08 AM
  4. download attachment from outlook email
    By saurabhlotankar in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2017, 05:39 AM
  5. Download Attachment from outlook by searching subject
    By lakshya2425 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-01-2015, 09:38 AM
  6. Download Outlook Attachment
    By rskfriends in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-03-2014, 02:32 PM
  7. Automatic Attachment Download from Outlook VBA Problem
    By bullo1854 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-26-2014, 05:06 PM

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