View Full Version : [SLEEPER:] Mail via Outlook non-responsive (Hang: Waiting for OLE...)
nikki333
04-03-2019, 11:55 AM
Hi Folks
I've implemented an error reporting macro that sends an e-mail with the error details upon closing the file.
The logic behind this is is, whenever an error occurs during runtime, the error details are logged in a dedicated error table within the same workbook.
Then, upon closing the workbook, a check is done whether the error table is empy or not. If not, a temporary copy of the file is made and send to me via Outllook.
This procedure worked perfectly for some time, but suddenly it makes Excel non-responsive, and after some time I get a message like:
"Excel is waiting for another application in order to complete an OLE action"
This will loop forever!
The line of code that will start the issue looks like so:
dim objOutlook as object
Set objOutlook = CreateObject("Outlook.application")
I've got Outlook running on my system with no issues otherwise
Any ideas?
Logit
04-03-2019, 06:17 PM
.
Not certain what is occurring there without having access to the workbook and code.
Here is a basic macro for sending email :
Sub Send_Mail_From_Excel()
Dim OutlookApp As Object
Dim OutlookMail As Object
Set OutlookApp = CreateObject("Outlook.Application")
Set OutlookMail = OutlookApp.CreateItem(0)
' Send Mass Email Using Excel VBA Macro Code
With OutlookMail
.To = ""
.CC = ""
.BCC = ""
.Subject = ""
.Body = ""
.Display '‘ or just put .Send to directly send the mail instead of display
End With
Set OutlookMail = Nothing
Set OutlookApp = Nothing
End Sub
nikki333
04-05-2019, 01:44 PM
it seems that it depends on the Outlook open/closed status, but not sure if it's only that. However, as far as I can tell:
If already open, the CreateObject("Outlook.Application") will lead to a crash. So this seems to work for now at least:
Set objOutlook = GetObject(, "Outlook.Application")
If Err.Number = 429 Then
Err.Clear
Set objOutlook = CreateObject("Outlook.Application")
If Not Err.Number = 0 Then
Exit Sub
End If
End if
On Error GoTo Fehler
Set objMail = objOutlook.CreateItem(0)
The app hang is still a mistery though
I'm not a programmer (well newby) but I don't understand why the windows crash log doesn't provide any valuable information
nikki333
04-10-2019, 11:43 AM
I've found another issue with the "Excel is waiting for another application in order to complete an OLE action" alert:
Indeed it happens that my Outlook is not responsive and I need to kill the task via task manager. In that case the OLE automation alert will pop up like every 10 seconds and will loop endlessly.
Is there a way to stop my macro from running after the first alert message has been shown? Or in case of application.displayalerts = false when it would have been shown?
Logit
04-10-2019, 12:19 PM
.
In the past I've experienced the same issue you are describing. My solution was to have Outlook open and running in the background. However you have indicated
doing so causes the macro to crash on your machine.
Question : Have you setup Outlook to connect with your email server ? For example, I have Outlook setup to connect to my Yahoo Email account.
nikki333
04-11-2019, 11:49 AM
Today I've found that Outlook goes into several states. I'm running Win10 and Office 365 on my private PC. At work with Win8 and Office 2013 this is not happening.
Those beeing: Outlook running/not running, handled by another application, and closing
So, on my private PC, let's assume Outlook is closed, then things seem to run as expected. However, if it's already running it might send the email one time and then go into the state of being handled by another application (showing this last symbol: 24049)
In that case the mail is sent, but things get weird afterwards.
Then, it can happen, for reasons unknown yet to me, that Outlook goes into closing (24050), but it will never ever close. At that point there is nothing I can do other than kill Excel and Outlook altogether.
I've got no idea, but maybe I need to get rid of the "Outlook is handled by another application" after sending an email.
Logit
04-11-2019, 12:01 PM
.
I wish I could answer your question. Maybe someone else on the Forum can assist ?
nikki333
04-13-2019, 01:36 PM
I havent't found any solutions to this issue yet, and ive never experienced this behaviour before. But I supect that it is related to the the 1809 windows update
Logit
04-13-2019, 04:06 PM
.
The only way I know to determine if that is the cause would be to return your system to a previous backup date ... or reload Windows without accepting updates until
you have tested the workbook.
nikki333
05-09-2019, 11:31 AM
I've read today that MS recognized this hang issue and has recommended to uninstall the last office update. great stuff
Logit
05-09-2019, 12:03 PM
.
Gotta love MS !
nikki333
05-21-2019, 10:54 AM
Is there a way to detect this state, ie. "Excel is waiting for an OLE application..." in order to handle the issue without killing outlook manually?
Logit
05-21-2019, 11:26 AM
.
If I correctly understand your request ... you can create a simple error handler, then direct VBA to do what you need.
Here is an example from this resource : https://stackoverflow.com/questions/9818539/is-it-possible-for-vba-to-detect-the-error-and-give-a-prompt-that-data-not-avail
Sub Sample()
On Error GoTo Whoa
' <REST OF YOUR CODE >
Lets Continue:
Exit Sub
Whoa:
' This gives the exact desription and the error number of the error
MsgBox "Description: " & Err.Description & vbNewLine & "Error Number : " & Err.Number
' This part resumes the code without breaking it :)
Resume LetsContinue
End Sub
The above doesn't correct anything. It simply displays the error then attempts to continue the code afterwards / exits the sub without doing anything more.
I presume you could replace the last part of the above error code to quit/shut down Excel via code commands if that is your wish.
Did you mention that MS states the cause is an update to Win. Have you specifically inquired of MS if there is a 'workaround' to circumvent the
error via VBA code ?
If you are not familiar, this website appears to have lots more folks who either work for MS or have their various MS Certifications. Perhaps posting your question
there would give you another avenue for a solution, as it has been several weeks since you've had activity on this thread.
https://stackoverflow.com/
nikki333
05-26-2019, 01:00 PM
Hi Logit
In fact you are not correct. I'm aware of proper Error Handing, however this one is escaping the error handling, because office thinks that there is no error around.
As mentioned at some point, I guess this is related to a bug in outlook. And that should be resolved by Microsoft later or sooner or the other way lol.
Logit
05-26-2019, 01:54 PM
.
Ok ... my apologies ... I totally missed it.
:thumb
(I'm going back to my safe space now ....)
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.