I've been trying to adapt Diane's code under "Use an Outlook Macro to Send Files by Email" using her array feature, but that array is fixed. I wish to change that fixed array into a variable array, much like the thread "Attachments to New email item" dated Oct 15, 2013. My ultimate goal is to run this as a macro or VBA once a month whereby the code would scan the invoice directory and for every unique invoice (there might be 15 or so), open a separate email using a pre-existing template (.oft) with the same 17 first letters and attach that invoice file and then display it. For example "P010213252 (FC42) YYYYYYYY.pdf" invoice file, then open the corresponding .oft template "P010213252 (FC42) XXXXX.oft". I'm using Outlook 16 under Win 10. I can get the fixed array to work to a certain extent, but the filename attached to each template is always the first .pdf file. I presume I need a second array for the .oft directory. Is there code available that can compare the two directories, one holding the invoices.pdf and the other holding the templates.oft, and if a match is found with the first 17 characters, then open that template .oft and load the matching .pdf file? I've searched but cannot find it. If it exists, please let me know. Thx.
https://forums.slipstick.com/forums/46-using-outlook/post-thread
https://forums.slipstick.com/forums/46-using-outlook/post-thread