outlook vba - VBA attach pdf based on subject line -



outlook vba - VBA attach pdf based on subject line -

update##

this have got suggestions far. im lost hell...

sub attach() set objoutlookmgs = application.activeinspector.currentitem dim subject string subject = dir("h:\contracts\alphabetical\") while len(subject) > 0 attachments.add subject subject = dir loop end sub original post

at work have contracts saved pdf's. send these people in stock email template in thing changes subject line , attachment. subject line same file name looking attach.

i create macro outlook uses subject line find , attach file stored in shared drive.

the file path h:\contracts\alphabetical\x x signifies letters a-z sub folders contain files stored based on first letter of subject line.

i have template utilize has fixed body. able run macro 1 time have entered subject line in template. subject line follows format

"account - ref - date"

format companyname - 12345675 - 23oct2014.

is there way of having macro search file name , attach automatically. can work way through attaching set file each time searching 1 have no thought about.

you not need create search file, know folder , file-name

i think should work:

with objoutlookmsg .attachments.add "h:\contracts\alphabetical\" & mid(objoutlookmsg.subject, 1, 1) & "\" & objoutlookmsg.subject & ".pdf" '(leave pdf-part away if in subject-line) end

i hope works, max

outlook-vba

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -