+ Reply to Thread
Results 1 to 3 of 3

Calling dflak... "save attachments to a file outside of outlook" - The Sequel!

  1. #1
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Calling dflak... "save attachments to a file outside of outlook" - The Sequel!

    Please see reference thread:

    https://www.excelforum.com/outlook-p...f-outlook.html

    I hesitated between replying to the above linked thread or starting a new one, because my question is basically the same as cmorten82's, word for word... the only difference I can see that would make me think the offered solution wouldn't also work for me is that I need my incoming attachments saved automatically, as they arrive, with no manual intervention whatsoever. My files arrive hourly, not daily, and the basic idea is that our company's bookkeeping program, "Epicor", is feeding me raw data hourly that I need automatically saved as it arrives, overwriting the last saved version, so that another spreadsheet has access to the most current data without having to interact directly with Epicor. The way our system is set up, I either have to manually run the required reports from Epicor and then export the result as an Excel spreadsheet, or I can have the IT department schedule the report to run automatically on a recurring interval and email me the spreadsheet version of the results. I still then need to save the attachment myself in order for the info to be accessible by my other spreadsheet... so I need to fully automate the process of saving attachments as they arrive.

    While dflak's program appears to be quite impressive and powerful, as I understand it this method would still require me to open a file and click a button in order to pull and save the attachments. I need them to automatically save in place of the previous saved version as they arrive, without prompting me to confirm that I want to overwrite the existing file. My computer stays on and running 24/7, and I already have a folder in my inbox set up with a rule that moves all incoming mail generated by Epicor to that folder (named "Epicor")… but I don't have the slightest idea how to get it to automatically save the attachment to a folder on my desktop (or preferably, on a network drive). Ideally, I would also have the email and attachment deleted from the "Epicor" email folder once the attachment has been saved in the desktop/network folder, but that is more a matter of housekeeping, and isn't essential for functionality. If I can automate the saving of the attachments, I don't mind having to essentially dump a trash can once a week... It sure would beat having to open an email and save an attachment once an hour, every hour, every day of the week.

    I don't need any fancy sorting or email searching, as any email that hits the "Epicor" folder with an attachment should simply have that attachment blindly saved to the destination folder. If the filename already exists, it should overwrite the existing file with the new file, without asking first (or apologizing afterwards). My Excel file will search that folder for the specific filename of the relevant Epicor generated report, so any other attachments "accidentally" automatically saved will just be ignored. This allows me to have different reports run and sent to me for other purposes in the future without the need for any additional code on the email side, as each different report will have a different file name. The destination folder simply needs to be a "dump bin" for all attachments that end up in the "Epicor" email folder.

    Seems like it should be a simple task, but I haven't messed with VBA in Outlook at all, or really anywhere but within Excel. And, to dflak's credit, every attempt at googling for the simplest or best way to do what I need done has landed me right back at another instance of the file offered as a solution in the linked thread above... so it has to be an awesome tool indeed, but in this case it's a precision screwdriver, and I need something more like a dull, rusty hammer. Or an old chunk of broken concrete.

    Any help here would be greatly appreciated... Thanks in advance!

  2. #2
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Re: Calling dflak... "save attachments to a file outside of outlook" - The Sequel!

    Okay, so I did some more digging and tinkering, and I got everything happening the way I need it to. As it turns out, all I needed to do was make a tiny and somewhat shady registry change, which added the option "run a script" to the list of things to have Outlook do when creating a rule. Then, I created this module (straight up copy/paste, my Google-Fu is strong), and call it from my rule:

    Please Login or Register  to view this content.
    And voila, now as long as Outlook is open on my computer, the report file is being overwritten every 30 minutes when it shows up, with no prompt or alert, just as I had imagined. Couldn't be more perfect!


    Now I'm going to play with adding "delete this email" to the rule, and see if it deletes the email before or AFTER it tries to run the script to save the attachment. If that doesn't work (i.e. deletes it before saving it, since I don't see a way to determine an order for the rule options and "delete" comes before "run script"), then I suppose I'll need to know what to add to the script to delete the email as part of the script, after saving the attachment.


    I'll be back... LOL!

  3. #3
    Forum Contributor
    Join Date
    10-01-2018
    Location
    Virginia Beach, VA
    MS-Off Ver
    365
    Posts
    129

    Re: Calling dflak... "save attachments to a file outside of outlook" - The Sequel!

    So adding "delete" to the rule worked, and I threw in "mark as read" for good measure, so the trash can doesn't keep getting hit with "unread" notifications.

    But, it dawned on me that if for some reason the script doesn't run properly, the rule will still delete the email, so I don't want that. I think I still want to delete the email from within the script, and permanently... not just moving it to the "deleted items" folder.


    So what would the command syntax be for killing the email, after pulling the attachment from it? I assume whatever it is would go at the end between "next" and "End Sub"?

+ 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. Save only attachments with "*.doc"
    By jaryszek in forum Outlook Formatting & Functions
    Replies: 1
    Last Post: 05-20-2017, 07:11 AM
  3. Macro needed to open "File Save As" and change save file type
    By blainerhett in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-28-2014, 02:40 PM
  4. [SOLVED] Script to save to folder in "v:\dept2", confirm file saved, then delete from "v:\dept1"
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-28-2014, 11:42 AM
  5. MSoffice Outlook 2003 message to be saved in C dir with the file name "From" "Sent" "Sub"
    By shailendra0509 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-09-2012, 01:32 AM
  6. "File name" in "Save As" dialogue blank
    By Minor7th in forum Excel General
    Replies: 2
    Last Post: 08-23-2011, 10:31 PM
  7. [SOLVED] Disabling "SAVE AS" option under "File"
    By Bidyut Bhattacharjee in forum Excel General
    Replies: 3
    Last Post: 03-22-2006, 02:40 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