Get Recipient address, Mail Content and Attachment

  • Thread starter Thread starter Cherry
  • Start date Start date
C

Cherry

I want to add a button in the toolbar, after a user finish
compose a mail, by click this toolbar button, it will
retrieve the recipient email address, Mail subject, Mail
content and the path of the attachment, it is possible to
get these information from a currently composing mail??

Do anyone have any idea how to get these information ??

Many Thanks
Cherry
 
Yes, this is definitely possible. The below procedure should give you an
idea of what you can access:

Sub GetEmailProperties()
Dim objMessage As Outlook.MailItem

Set objMessage = ActiveInspector.CurrentItem 'GETS THE CURRENTLY OPEN
NEW MESSAGE
Debug.Print objMessage.Recipients.Item(1).Address
Debug.Print objMessage.Subject
Debug.Print objMessage.Body
Debug.Print objMessage.Attachments.Item(1).FileName
'NOTE: you cannot access the path of the attachment, since it is no
longer 'relevant' after it is attached to the message.
'However, the PathName property gives you the full path for linked
(embedded) files
End Sub
 
Back
Top