Endless loop in Email macro - OLE action?

ChuckDrago

Active Member
Joined
Sep 7, 2007
Messages
470
Office Version
  1. 2010
Platform
  1. 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
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Watch MrExcel Video

Forum statistics

Threads
1,129,317
Messages
5,635,527
Members
416,862
Latest member
MGDlite

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top