vba - find and replace using macro in the subject of an active email -


i have mis produces automated email work instructions. have manipulated crystal report make order acknowledgement , replace words in subject "work instruction '1234' 'date' etc" "order acknowledgement '1234' 'date' etc".

i want click macro button have added 'compose email' screen this

here have tried, doesn't work.

sub orderack()     dim ordack string     dim newmail outlook.mailitem      set newmail = application.activeinspector.currentitem      ordack = replace(newmail.subject, "works instruction", "order acknowledgement")      newmail.subject = ordack     newmail.subject = display  end sub 

to edit subject line try following


option explicit sub orderack()     dim olitem object     dim ordack string     dim snew string     dim newmail outlook.application      set newmail = application     set olitem = newmail.activeexplorer.selection.item(1)      ordack = replace(olitem.subject, "works instruction", "order acknowledgement")      snew = ordack     olitem.subject = snew     olitem.save end sub 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -