Results 1 to 4 of 4

Thread: Pulling Outlook item attachments into Excel

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    2

    Pulling Outlook item attachments into Excel

    I am trying to make a bulletproof Excel feature to open Outlook email attachments on the fly. At present it works except when there are date, subject, or attachment name mismatches. When this occurs, I can prompt the user to select the folder, enter the email subject name, and the date received, and it will work - but it's an enormous hassle. Does anyone have a workaround for simulating a 'pickmail' method that works in the same way as 'pickfolder'? Anything that will return the mailitem entryId at runtime so I can refer to it would do.

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Pulling Outlook item attachments into Excel

    Welcome to the Forums.

    You can use the .Find or .Restrict method of the items collection of Outlook to search for a particular mailitem. Your search criteria will need to be able to pick out a unique mailitem in order to make it return just one mailitem.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    2

    Re: Pulling Outlook item attachments into Excel

    Thanks for that RobDog, and thanks for the welcome.

    My problem with using .find is that I am looking for a selection method that takes a single user input on the fly - I am dealing with emails of like subject and attachment name, so I need three parameters - mail folder, mail subject name (index), and date received. Because of this, I would rather have a mail selection method where the user can navigate through a popup outlook dialogue and select the desired mail, similar to pickfolder. I guess I could have a popup form in excel with dropdowns populated by folders, email items within selected folders, and a daterange, but this is highish overhead for what I am trying to achieve.

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Pulling Outlook item attachments into Excel

    You can show Outlook with just the explorer window open and let them select the item in Outlook. Then use that Outlook.Selection object in Excel to do whatever you want. It may be slow if they dont already have Outlook open/running.

    The 3 paramaters are fine to use in a .Find as the .Find will be off if whatever folder they select. You can present the .PickFolder and use that to base your .Find off of. then pass the Subject and Received Date as your two parameters for the .Find. Only thing is that they will need to know the exact subject or it wont match, same with the received date/time.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

Posting Permissions

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



Click Here to Expand Forum to Full Width