VBOffice

Making Attachment Name the Message Subject

See how to display automatically the name of an attachment as the subject of the message.

Last modified: 2016/11/25 | Accessed: 23.557  | #161
◀ Previous sample Next sample ▶
ReplyAll ReplyAll
ReplyAll alerts you before unintentionally replying all, or if you are a confidential BCC recipient of the e-mail.

Paste the code into the 'ThisOutlookSession' module and restart Outlook. As soon as you add a new attachment to an email its name will be displayed as the subject of the message.


tip  How to add macros to Outlook
Private WithEvents Mail As Outlook.MailItem
Private WithEvents Inspectors As Outlook.Inspectors

Private Sub Application_Startup()
  Set Inspectors = Application.Inspectors
End Sub

Private Sub Inspectors_NewInspector(ByVal Inspector As Inspector)
  If TypeOf Inspector.CurrentItem Is Outlook.MailItem Then
    Set Mail = Inspector.CurrentItem
  End If
End Sub

Private Sub Mail_AttachmentAdd(ByVal Attachment As Attachment)
  Mail.Subject = Attachment.DisplayName
End Sub
SAM SAM
Determine the "identity" of your emails. Set with SAM the sender and the folder folder for sent items with the help of rules.
email  Send a message