ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How Do I attach a atachment to a VBA created email? (https://www.excelbanter.com/excel-programming/320777-how-do-i-attach-atachment-vba-created-email.html)

Dan Gardner

How Do I attach a atachment to a VBA created email?
 
Ive created an outlook email in a macro using the following code;

'Control Microsoft Outlook and create a new Email
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.To = Worksheets("Sheet1").Cells(2, 17).Value
'Assign a Subject to the Email
myItem.Subject = Worksheets("Sheet1").Cells(1, 1).Value
'Attach File to Mesage
myItem.body = ???????

'Send the Email
myItem.Send

As you can see I can't seam to figure out the Attach file command. Any help
would be greatly appreciated.

Thanks,
Dan


Norman Jones

How Do I attach a atachment to a VBA created email?
 
Hi Dan,

Visit Ron de Bruin's web site at:

http://www.rondebruin.nl/sendmail.htm


---
Regards,
Norman



"Dan Gardner" wrote in message
...
I've created an outlook email in a macro using the following code;

'Control Microsoft Outlook and create a new Email
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.CreateItem(olMailItem)
myItem.To = Worksheets("Sheet1").Cells(2, 17).Value
'Assign a Subject to the Email
myItem.Subject = Worksheets("Sheet1").Cells(1, 1).Value
'Attach File to Mesage
myItem.body = ???????

'Send the Email
myItem.Send

As you can see I can't seam to figure out the Attach file command. Any
help
would be greatly appreciated.

Thanks,
Dan





All times are GMT +1. The time now is 10:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com