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

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

Forum statistics

Threads
1,224,820
Messages
6,181,160
Members
453,021
Latest member
Justyna P

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
Back
Top