Hi
I am trying to add an attachment to the outlook mail using a macro… however when I have tired the below code…
Attachment is not added
I have made sure that I have changed the setting in the excel
2) Tools>References in the Menu bar
3) Placed a Checkmark before Microsoft Outlook 14.0 Object Library
Public Function Mail()
If Selection.Offset.Value <> "" Then
Do Until Selection.Offset.Value = ""
ActiveCell.Offset(0, 8).Select
A = ActiveCell.Value
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.sentonbehalfofname = A
ActiveCell.Offset(0, 1).Select
.To = ActiveCell.Value
ActiveCell.Offset(0, 1).Select
.CC = ActiveCell.Value
'.BCC = ""
ActiveCell.Offset(0, -10).Select
.Subject = ActiveCell.Value & "- XYZ POs Closing"
.Close olSave
ActiveCell.Offset(0, 11).Select
strbdy = "Dear " & ActiveCell.Value & vbCrLf & "<br><br>XYZ company is closing any open Purchase Orders (POs) in Ariba prior to 2014.Thanks!<br>" & vbCrLf & "<br>"
strbdy1 = "1.Purchase Orders that are sent from Ariba must be invoiced via the Ariba Network " & "<br>2.Invoicing must be completed within 60 days of product shipment.<br>" & vbCrLf & "<br>"
Strbdy2 = "In case of any furthur information/questions kindly contact Syed at kiran@xyz.com. Thanks!." & "<br><br>Regards<br>Kiran" & vbCrLf & "<br>"
.htmlBody = strbdy & strbdy1 & Strbdy2
.Attachements.Add ("C:\Users\kkuma\Desktop\project aa")
.Save
.display
'.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
ActiveCell.Offset(0, -11).Select
Selection.Offset(1, 0).Select
Loop
MessageBox
Else
MessageBox
End If
End Function
Could someone kindly suggest the proper way.
Thank you
Bookmarks