VBA to send Outlook email - stuck in Outbox
On Wed, 22 Jun 2016 08:02:40 +0200, Claus Busch
wrote:
Hi Frank,
Am Tue, 21 Jun 2016 17:36:20 -0400 schrieb Phrank:
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
step through your code with F8. After the line
Set OutApp = CreateObject("Outlook.Application")
you see the Outlook icon in the taskbar. Excel send the mail to the
outbox. With End Sub Outlook is nothing and it is closed. If you didn't
send immendiatly and the interval to send is longer than the macro needs
for running the mail remains in the outbox. Perhaps it tooks too long
time to sign in at the mail provider.
With stepping through the code check how long it last to send the mail
and let Excel wait this time.
Regards
Claus B.
Ah, I was actually wondering about that after I sent my message
yesterday. I just tested it, and I'm not actually seeing the Outlook
icon show up in my taskbar. I have it pinned there, and when it's
opened, you can see it's highlighted, but it never highlights as if
it's open. The only time it highlights is when it gets to the
..Display line of code, and then only briefly. I delayed a long time
after hitting .Send, but the message remained in my Outbox.
I stepped through again, this time with the Locals window open, and
at the OutApp step, it's showing AnswerWizard in the Expression field,
and <operation failed in the Value field. And of course, under the
OutMail expression, there's Application, which shows a value of <The
operation failed. Which is telling me that it's not opening an
instance of Outlook, which is probably why the message is remaining in
the Outbox. Any thoughts on why and how to get that to not fail?
Thanks gentlemen!
Frank
|