How add attachment to outlook from another app RRS feed

  • Question

  • I want create button email copy to outlook but can't found any solution to pass file from my app to outlook
    Thursday, October 10, 2019 2:56 PM

All replies

  • Hello,

    It is not clear which application you are developing. The Attachments.Add method creates a new attachment in the Attachments collection. The source of the attachment can be a file (represented by the full file system path with a file name) or an Outlook item that constitutes the attachment.

    Sub AddAttachment() 
     Dim myItem As Outlook.MailItem 
     Dim myAttachments As Outlook.Attachments 
     Set myItem = Application.CreateItem(olMailItem) 
     Set myAttachments = myItem.Attachments 
     myAttachments.Add "C:\Test.doc", _ 
     olByValue, 1, "Test" 
    End Sub

    profile for Eugene Astafiev at Stack Overflow, Q&A for professional and enthusiast programmers

    Thursday, October 10, 2019 3:06 PM