Hi.
I wrote this macro in order to send an excel file as attachment to more recipients:
Sub Send_Mail_Array()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim wbname As String
Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
wbname = "C:/" & "Attached File" & " " & _
Format(Now, "dd-mm-yy hh-mm-ss") & ".xls"
wb1.SaveCopyAs wbname
Set wb2 = Workbooks.Open(wbname)
With wb2
Response = MsgBox("an attached file will be sent to these recipients: XXX, YYY, ZZZ. Are you sure you want to go on?", vbYesNo + vbExclamation)
If Response = vbNo Then
ElseIf Response = vbYes Then
.sendmail Array("XXX@mail.com", "YYY@mail.com", "ZZZ@mail.com")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
ddhtd = MsgBox("Mails have been sent!", vbInformation + vbOKOnly)
End If
End With
Application.ScreenUpdating = True
End Sub
******
The problem is that: if just one of the recipients has exceeded the capacity of the inbox and the mail addressed to him/her fail, emails cannot reach the other recipients - result: no email sent at all...How can I correct my macro?
Thanx in advance
Bogumil
I wrote this macro in order to send an excel file as attachment to more recipients:
Sub Send_Mail_Array()
Dim wb1 As Workbook
Dim wb2 As Workbook
Dim wbname As String
Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook
wbname = "C:/" & "Attached File" & " " & _
Format(Now, "dd-mm-yy hh-mm-ss") & ".xls"
wb1.SaveCopyAs wbname
Set wb2 = Workbooks.Open(wbname)
With wb2
Response = MsgBox("an attached file will be sent to these recipients: XXX, YYY, ZZZ. Are you sure you want to go on?", vbYesNo + vbExclamation)
If Response = vbNo Then
ElseIf Response = vbYes Then
.sendmail Array("XXX@mail.com", "YYY@mail.com", "ZZZ@mail.com")
.ChangeFileAccess xlReadOnly
Kill .FullName
.Close False
ddhtd = MsgBox("Mails have been sent!", vbInformation + vbOKOnly)
End If
End With
Application.ScreenUpdating = True
End Sub
******
The problem is that: if just one of the recipients has exceeded the capacity of the inbox and the mail addressed to him/her fail, emails cannot reach the other recipients - result: no email sent at all...How can I correct my macro?
Thanx in advance
Bogumil