ChuckDrago
Active Member
- Joined
- Sep 7, 2007
- Messages
- 470
- Office Version
- 2010
- Platform
- Windows
Hi everyone,
Need some help with the following macro
<code/>Sub Mailer(SendTo, CcTo, Subj, TxtBody)
Dim OutApp As Object
Dim OutMail As Object
On Error Resume Next
Application.DisplayAlerts = False
ActiveWorkbook.Save
Application.DisplayAlerts = True
Set OutApp = CreateObject("Outlook.Application.16")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = SendTo
.CC = CcTo
.Subject = Subj
.Body = TxtBody
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
MsgBox "Email successfully sent", vbInformation + vbOKOnly
End Sub</code>
When this code operated on Windows 7 Professional machines it ran without a hitch (except that the application was 14 instead of 16). Now, under OS W10, it delivers the email and the attachment but it displays the MsgBox and remains in an endless loop status until the OK button is clicked. Any suggestions to eliminate this annoyance?
As usual, much obliged.
Chuck
Need some help with the following macro
<code/>Sub Mailer(SendTo, CcTo, Subj, TxtBody)
Dim OutApp As Object
Dim OutMail As Object
On Error Resume Next
Application.DisplayAlerts = False
ActiveWorkbook.Save
Application.DisplayAlerts = True
Set OutApp = CreateObject("Outlook.Application.16")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = SendTo
.CC = CcTo
.Subject = Subj
.Body = TxtBody
.Attachments.Add ActiveWorkbook.FullName
.Send
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
MsgBox "Email successfully sent", vbInformation + vbOKOnly
End Sub</code>
When this code operated on Windows 7 Professional machines it ran without a hitch (except that the application was 14 instead of 16). Now, under OS W10, it delivers the email and the attachment but it displays the MsgBox and remains in an endless loop status until the OK button is clicked. Any suggestions to eliminate this annoyance?
As usual, much obliged.
Chuck