Outlook VBA to auto-save attachments

mosabur

New Member
Joined
Oct 6, 2017
Messages
2
Hi All,

Some help please.

I'm trying to write vba code that runs on new emails that are already in a shared mail box or arrive at that same shared mailbox.

The emails will have a specific subject such as "Output for PS2 model" in the subject line with a crucial difference being that part of the subject line will reference a 2 or 4 digit code i.e. SL or TBGE. The full subject line might be: "Output for PS2 model Client:/Dss/TBGE_DSS." or "Output for PS2 model Client:/Dss/SL_DSS."

These emails will arrive in the mailbox daily and will have an attachment that references the fund code.

The macro has to save the attachment into a shared folder with filepath: J:\GROUPS\Invest\Decision Support System. At this filepath location there will be sub folders referenced with the fund codes i.e. TBGE or SL. So the full filepath for TBGE is J:\GROUPS\Invest\Decision Support System\TBGE. The attachment needs to be saved into its respective sub folder. The name of the file when saved should reference the previous working day and then the fund code, e.g. 02-10-17_TBGE. This will ultimately lead to an archive of files within each folder.

Should another email arrive with same subject reference fund code on the same date then I would like the attachment to save over the attachment that is already there. No need to call it another version.

Any help would be greatly appreciated.

Thanks
Regards
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
I did think you could teach Outlook to do that itself, without trying to control via Excel, (in the Rules)
 
Upvote 0
I did think you could teach Outlook to do that itself, without trying to control via Excel, (in the Rules)

My currently process already uses rules that trigger a script. I have the rules on my outlook as to do a couple of the colleagues. This is so that in my absence the attachments still get saved. What we've found is that the rules don't always work. Sometimes we have to re-add the rules and turn them on. Essentially we've found the rules to be somewhat unstable.

This is why I've decided to use vba. Also I think vba will allow us to better control the list of funds.

Thanks

Regards
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top