View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Phrank Phrank is offline
external usenet poster
 
Posts: 153
Default VBA to send Outlook email - stuck in Outbox

On Mon, 20 Jun 2016 15:01:52 +0200, Claus Busch
wrote:

Hi Frank,

Am Mon, 20 Jun 2016 08:35:15 -0400 schrieb Phrank:

Hi. At work, employees have an individual report in a folder that they
are supposed to do each day. When they are done, there is a signoff
sheet in their workbook to which they are supposed to add their
initials. Obviously, that sometimes gets forgotten. So, my colleague
and I created a macro the loops through all of the workbooks in the
folder and looks at the sign off sheet. If the individual's initials
are not there, the macro sends the person an email. This works
absolutely fine if/when Outlook is open, but if Outlook happens to be
closed, the emails get stuck in the Outbox.


with
set appOut = CreateObject("Outlook.Application")
you start Outlook.

That your mail is in the outbox causes of the settings in Outlook.
Activate in Outlook options = Advanced = Send and receive
"Send immediatly when connected"


Regards
Claus B.



Hi Claus,

Thanks for the reply. Unfortunately, we already have that
CreateObject line in our code. We have this:

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

and we also already checked the options and have it set to send
immediately when it's connected. So with the CreateObject line, it is
able to create the email message and even start to send it, but
Outlook will only release it if Outlook is already open when the macro
kicks off. Strange. Other things I've tried have been:

- selected in the Advanced options to 'Perform an automatic
send/receive when exiting', to no avail.
- Added .Display above .Send.

Nothing is forcing the email through.

Frank