PDA

View Full Version : Run a script rule



gazmoz17
09-17-2021, 05:11 AM
Hi,

In an effort to become paperless, anything to do with purchase ledger, I want to make a script rule which sends to a sub folder, marks as certain category and saves attachment (90% of time PDF) in certain g:drive folder with a file naming convention.

Sub folders:

Direct
PO
Confirmation
Delivery Notes
Invoices
Statements



Categories:


PO
Confirmation
Delivery Note
Invoice
Statement


;don't require a "Direct Category"

I'm able to use normal outlook rules for move to folder and assign category.....there's about 30 indiv rules based on supplier name etc that achieve this.

Had a look at some vba scripts but would I have to have 30 diff scripts to tag onto my 30 current move to folder/assign cat scripts. To assign the separate file name pathways?

Or can I adapt a script that knows if a email hits "Invoice" it saves to Gmail\blah\blah\Invoices.

Email hits Delivery Notes it saves to Gmail\blah\blah\Delivery Notes

File naming Convention

Date & Time received email and who supplier is. Joe Bloggs Ltd 17/09/21 11.34am

Also a way of marking if any duplicate files Joe Bloggs Ltd 17/09/21 11.34am (2)

Many Thanks
Gareth

gmayor
09-17-2021, 10:57 PM
See the code at http://www.vbaexpress.com/forum/showthread.php?68712-Saving-Attachment-from-Multiple-Emails-As-MSG-Files-In-Bulk-In-Outlook&highlight=FileNameUnique%28 which should point you in the right direction.
Note that 'Joe Bloggs Ltd 17/09/21 11.34am' contains illegal filename characters so cannot be used as a filename pattern .

gazmoz17
09-20-2021, 04:50 AM
Hi, thank you very much for the reply.

Its more than a little over my head!

So I have say 20 indiv outlook rules per Supplier which will put the email into my outlook subfolder "Invoices".

Anything that hits "Invoices" sub folder I want the attachment saving in: G:\My Drive\Outlook attachments\Invoices

Could you please help with code you sent a link to? (Tried to include it here but got an error and wouldn't let me post)

Where do I specify my outlook invoices subfolder?

Thanks