Activating specific email in Outlook with VBA & deleting signature from the copied text -


i'm looking use get function in vba in order activate specific email in outlook , copy body new email , send. can use getlast function latest email in inbox, refine code more selecting latest email specific email address.

also, i'd love how know how delete signature text pasted new email.

sub negotiations()  dim objmsg outlook.mailitem dim objitem outlook.mailitem dim bodytext object dim myinspector outlook.inspector dim myitem outlook.mailitem dim newmail mailitem, oinspector inspector  set myitem = application.session.getdefaultfolder(olfolderinbox).items.getlast myitem.display  'copy body of current item  set activemailmessage = activeinspector.currentitem activemailmessage.getinspector().wordeditor.range.formattedtext.copy  ' create message. set objmsg = application.createitem(olmailitem)  'paste body new email set bodytext = objmsg.getinspector.wordeditor.range bodytext.paste  'set , send notification email objmsg     .to = "@gmail.com"     .subject = "negotiations"     .htmlbody = activemailmessage.htmlbody     .display  end end sub 

any appreciated, thank guys!

open inbox folder using namespace.getdefaultfolder(olfolderinbox), retrieve items collection mapifolder.items. sort items (items.sort) on receivedtime property, retrieve latest email using items.find on senderemailaddress property.


Comments