+ Reply to Thread
Results 1 to 7 of 7

Create macro to open daily email and Excel attachment from Outlook

  1. #1
    Registered User
    Join Date
    09-10-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    3

    Create macro to open daily email and Excel attachment from Outlook

    Hello

    I receive an email on a daily basis with a standard subject (Fund) which always holds an Excel file with a title that differs slightly (by date - eg ABC07.09.12) from day to day.

    Would you be able to suggest how I can create a VBA macro that lets me find the email each day, open it and then save the attachment down in to a specific folder.

    I'm new to VBA but am trying to pick things up as I go along.

    Thanks!
    Tricia

  2. #2
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Create macro to open daily email and Excel attachment from Outlook

    The following macro will search for read and unread emails that have the subject "Fund". For each email it finds, it checks whether there are any attachments. If so, it saves any attachment to the specified folder. If, however, the file already exists, it asks whether you want to overwrite the file. Then, when it's finished with processing the email, it moves it to a subfolder within the InBox. If you don't already have a subfolder, create one and name it as desired. For this example, the subfolder is called "Fund". Note that the email is moved from the InBox to a subfolder once it processed so that it doesn't get processed a second time.


    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    09-10-2012
    Location
    London
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Create macro to open daily email and Excel attachment from Outlook

    Thank you Domenic. This is brilliant. I don't yet understand the objective of the Dim command - it seems to define applications in macro code - so the olApp example is the flag/term that relates to the Outlook application (which is recognised by VBA code), I think....but I need to learn all about this!

  4. #4
    Forum Expert
    Join Date
    06-18-2004
    Location
    Canada
    MS-Off Ver
    Office 2016
    Posts
    1,474

    Re: Create macro to open daily email and Excel attachment from Outlook

    You're very welcome! Thanks for the feedback!

    As per the help file, "the Dim statement is used to declare variables and allocate storage space". For additional information, have a look at the following articles...

    http://support.microsoft.com/kb/843144

    http://msdn.microsoft.com/en-us/libr...ffice.10).aspx
    Last edited by Domenic; 09-14-2012 at 06:13 PM.

  5. #5
    Registered User
    Join Date
    07-17-2012
    Location
    Auckland
    MS-Off Ver
    Excel 2010
    Posts
    36

    Re: Create macro to open daily email and Excel attachment from Outlook

    I can't get this to work and I am using excel 10. Am i missing something? thanks

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Create macro to open daily email and Excel attachment from Outlook

    UimhirADo,

    Welcome to the Forum, unfortunately:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  7. #7
    Registered User
    Join Date
    05-02-2013
    Location
    Nigeria
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: Create macro to open daily email and Excel attachment from Outlook

    Get the outlook plugin from mapilab great stress relief.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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