Originally Posted by
Excel Fox
Hi finding_dory,
Welcome to ExcelFox
Did you try using
this
Hey Excel Fox, thanks for the reply! I used the below codes but it doesnt attach any files to my email.. could you provide me with codes that command for file attachment and where in my codes should i insert them? Thank you once again!
VBA Code I used:
Code:
Private Sub CommandButton2_Click()
Dim OutlookApp As Outlook.Application
Dim MItem As Outlook.MailItem
Dim cell As Range
Dim Subj As String
Dim EmailAddr As String
Dim Recipient As String
Dim Msg As String
Dim objOutlookAttach As Outlook.Attachment
'Create Outlook object
Set OutlookApp = New Outlook.Application
'Loop through the rows
For Each cell In Columns("B").Cells.SpecialCells(xlCellTypeVisible)
If cell.Value Like "*@*" Then
EmailAddr1 = EmailAddr1 & ";" & cell.Value
End If
Next
For Each cell In Columns("E").Cells.SpecialCells(xlCellTypeVisible)
If cell.Value Like "*@*" Then
EmailAddr2 = EmailAddr2 & ";" & cell.Value
End If
Next
For Each cell In Columns("H").Cells.SpecialCells(xlCellTypeVisible)
If cell.Value Like "*@*" Then
EmailAddr3 = EmailAddr3 & ";" & cell.Value
End If
Next
'Create Mail Item and view before sending
Set MItem = OutlookApp.CreateItem(olMailItem)
With MItem
.To = EmailAddr2
.BCC = EmailAddr1
.CC = EmailAddr3
.Subject = Sheet2.Cells(5, 2).Value
.Body = Sheet2.Cells(7, 2).Value
.Display
End With
End Sub
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
Bookmarks