+ Reply to Thread
Results 1 to 11 of 11

Outlook Add Multiple Attachments via file dialog box

  1. #1
    Registered User
    Join Date
    06-16-2016
    Location
    Moscow
    MS-Off Ver
    2010
    Posts
    5

    Outlook Add Multiple Attachments via file dialog box

    Hello,

    I'm trying to write a code which would add files to currently opened email via file dialog box. But I can't find any proper information about file dialog box in Outlook. Could someone help me with this?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Outlook Add Multiple Attachments via file dialog box

    Select all the attachments that you want to add when file selection dialog appears.

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    06-16-2016
    Location
    Moscow
    MS-Off Ver
    2010
    Posts
    5

    Re: Outlook Add Multiple Attachments via file dialog box

    Thank you!

    Made it work turning on Excel Object Library in References and changing the code a bit.

    Please Login or Register  to view this content.
    But I have another question: How can I set a default path for file selection dialog?
    I've tried
    Please Login or Register  to view this content.
    Doesn't work

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Outlook Add Multiple Attachments via file dialog box

    It does work, if you use ChDir right before the dialog:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-16-2016
    Location
    Moscow
    MS-Off Ver
    2010
    Posts
    5

    Re: Outlook Add Multiple Attachments via file dialog box

    Still no luck... It keeps opening default "Documents" path.
    As we use Excel.application with GetOpenFilename, Shouldn't the ChDrive and ChDir relate to Excel too?

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Outlook Add Multiple Attachments via file dialog box

    Well, that code works for me, but there is an alternative, using API calls.

    Try this (Whether you need the PtrSafe or not depends on your version of Excel - mine is 64 bit so it is needed. If you have 32 bit Excel remove the PtrSafe)

    This code needs to go at the top of your module.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-16-2016
    Location
    Moscow
    MS-Off Ver
    2010
    Posts
    5

    Re: Outlook Add Multiple Attachments via file dialog box

    Funny, but the directory is still the same...

  8. #8
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Outlook Add Multiple Attachments via file dialog box

    Yes, the directory path is still the same - that is the directory you used in your code - but it is set a different way. Did the code work for you?

  9. #9
    Registered User
    Join Date
    06-16-2016
    Location
    Moscow
    MS-Off Ver
    2010
    Posts
    5

    Re: Outlook Add Multiple Attachments via file dialog box

    Sorry, i meant the code still opens the default "Documents" path. It didn't work for some reason.

  10. #10
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Outlook Add Multiple Attachments via file dialog box

    And no error message... Sorry, I'm at a loss for an explanation.

  11. #11
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Outlook Add Multiple Attachments via file dialog box

    You might use Excel’s FileDialog which has an initialfilename property where you can set the directory. Also note that you should be explicitly creating an instance of the Excel Application, not relying on an implicit one that you can’t terminate.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ 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. [SOLVED] Save attachments to a file outside of Outlook
    By cmorten82 in forum Outlook Programming / VBA / Macros
    Replies: 2
    Last Post: 02-21-2018, 08:06 PM
  2. Using .attachments.add to attach an excel file to an outlook email
    By mirandajean in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-19-2017, 11:48 AM
  3. copy data from outlook email attachments to a local file
    By s_samira_21 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2014, 10:24 AM
  4. [SOLVED] NEED HELP! E-Mailing Multiple recipients with different attachments using Outlook
    By estratosphere in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2014, 05:12 AM
  5. Extracting Attachments from outlook based on subject title /file name and between a date
    By himynameisiain in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-14-2013, 02:14 PM
  6. Excel Macro to download attachments from multiple sub folders of outlook
    By abhay_547 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-31-2010, 09:32 AM

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