• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Draft Mail

Dear Team,

Please help me with the code below :
<< Use Code -tags >>
Code:
Sub Drafts()
Dim oMSOutlook As Object
Dim oEmail As Object
Dim i As Integer
Dim strBody As String
Dim Pth As String
Pth = "I:\computer\"
Set oMSOutlook = CreateObject("Outlook.Application")
For i = 2 To Cells(ActiveSheet.Rows.Count, 1).End(xlUp).Row
Set oEmail = oMSOutlook.CreateItem(olMailItem)
With oEmail
.To = Cells(i, 2)
.Cc = Cells(i, 3)
.Bcc = Cells(i, 4)
.Subject = Cells(i, 5)
.Body = Cells(i, 6)
.Attachments.Add Pth & Dir(Pth & Range("H" & i) & ".xlsb")
End With
Next i
Set oMSOutlook = Nothing
Set oEmail = Nothing
End Sub

I need to create a code where it attach file with name return in Column I.

But the scenario is the file name given in column I should search in multiple sub folder and then it should attach the file.

Sample has been shared with this.
 

Attachments

  • Mail (2).xlsm
    23.8 KB · Views: 2
Last edited by a moderator:
Back
Top