Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-access > #9957 > unrolled thread
| Started by | Patrick Finucane <patrickfinucanetx@gmail.com> |
|---|---|
| First post | 2014-10-02 10:59 -0700 |
| Last post | 2014-10-10 15:44 -0500 |
| Articles | 15 — 5 participants |
Back to article view | Back to comp.databases.ms-access
Access 2013 and sending an email. Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-10-02 10:59 -0700
Re: Access 2013 and sending an email. Norman Peelman <npeelman@cfl.rr.com> - 2014-10-02 19:52 -0400
Re: Access 2013 and sending an email. Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-10-03 06:06 -0700
Re: Access 2013 and sending an email. Norman Peelman <npeelman@cfl.rr.com> - 2014-10-04 08:58 -0400
Re: Access 2013 and sending an email. Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-10-06 06:25 -0700
Re: Access 2013 and sending an email. JB Guernsey <jeff@angelsystems.co.uk> - 2014-10-06 07:58 -0700
Re: Access 2013 and sending an email. Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-10-06 09:27 -0700
Re: Access 2013 and sending an email. JB Guernsey <jeff@angelsystems.co.uk> - 2014-10-06 10:24 -0700
Re: Access 2013 and sending an email. Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-10-06 10:35 -0700
Re: Access 2013 and sending an email. JB Guernsey <jeff@angelsystems.co.uk> - 2014-10-06 13:19 -0700
Re: Access 2013 and sending an email. Neil <xxx@gmail.com> - 2014-10-03 01:05 -0500
Re: Access 2013 and sending an email. Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-10-03 06:13 -0700
Re: Access 2013 and sending an email. Neil <xxx@gmail.com> - 2014-10-03 14:31 -0500
Re: Access 2013 and sending an email. Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-10-06 06:14 -0700
Re: Access 2013 and sending an email. fmsinc <fmsinc@gmail.com> - 2014-10-10 15:44 -0500
| From | Patrick Finucane <patrickfinucanetx@gmail.com> |
|---|---|
| Date | 2014-10-02 10:59 -0700 |
| Subject | Access 2013 and sending an email. |
| Message-ID | <076e8a04-1f71-4d6a-a933-357b195bf2b0@googlegroups.com> |
I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this
If DisplayEmail Then
.Display
Else
.Save
.Send
End If
After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message.
How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly.
[toc] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2014-10-02 19:52 -0400 |
| Message-ID | <m0kog6$r5g$1@dont-email.me> |
| In reply to | #9957 |
On 10/02/2014 01:59 PM, Patrick Finucane wrote: > I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this > If DisplayEmail Then > .Display > Else > .Save > .Send > End If > > After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message. > > How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly. > If Outlook isn't open then how will you see the Inbox? I think you'll find that your email is being sent just fine. You are only dealing with the *new message* window at this point. And unless you have certain security features turned off, you may find that your ELSE statement fails on the .Send command. -- Norman Registered Linux user #461062 AMD64X2 6400+ Ubuntu 10.04 64bit
[toc] | [prev] | [next] | [standalone]
| From | Patrick Finucane <patrickfinucanetx@gmail.com> |
|---|---|
| Date | 2014-10-03 06:06 -0700 |
| Message-ID | <f80ba586-b82a-408e-aa42-a5325ef72768@googlegroups.com> |
| In reply to | #9959 |
On Thursday, October 2, 2014 7:52:36 PM UTC-4, Norman Peelman wrote: > On 10/02/2014 01:59 PM, Patrick Finucane wrote: > > > I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this > > > If DisplayEmail Then > > > .Display > > > Else > > > .Save > > > .Send > > > End If > > > > > > After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message. > > > > > > How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly. > > > > > > > If Outlook isn't open then how will you see the Inbox? I think > > you'll find that your email is being sent just fine. You are only > > dealing with the *new message* window at this point. And unless you have > > certain security features turned off, you may find that your ELSE > > statement fails on the .Send command. > > > > > > -- > > Norman > > Registered Linux user #461062 > > AMD64X2 6400+ Ubuntu 10.04 64bit OK. I send the message to my GMail account. I send it via Outlook. I have my web browser opened to Gmail. I can wait an hour or two and no msg. When I open Outlook, I get the msg in Gmail immediately. What surprises me is that I thought .Display made the process Modal and would stop until sent or canceled but the code after .Display just kept on chugging away.
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2014-10-04 08:58 -0400 |
| Message-ID | <m0oqu6$5gl$1@dont-email.me> |
| In reply to | #9966 |
On 10/03/2014 09:06 AM, Patrick Finucane wrote:
> On Thursday, October 2, 2014 7:52:36 PM UTC-4, Norman Peelman wrote:
>> On 10/02/2014 01:59 PM, Patrick Finucane wrote:
>>
>>> I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this
>>
>>> If DisplayEmail Then
>>
>>> .Display
>>
>>> Else
>>
>>> .Save
>>
>>> .Send
>>
>>> End If
>>
>>>
>>
>>> After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message.
>>
>>>
>>
>>> How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly.
>>
>>>
>>
>>
>>
>> If Outlook isn't open then how will you see the Inbox? I think
>>
>> you'll find that your email is being sent just fine. You are only
>>
>> dealing with the *new message* window at this point. And unless you have
>>
>> certain security features turned off, you may find that your ELSE
>>
>> statement fails on the .Send command.
>>
>>
>>
>>
>>
>> --
>>
>> Norman
>>
>> Registered Linux user #461062
>>
>> AMD64X2 6400+ Ubuntu 10.04 64bit
>
> OK. I send the message to my GMail account. I send it via Outlook. I have my web browser opened to Gmail. I can wait an hour or two and no msg. When I open Outlook, I get the msg in Gmail immediately.
>
> What surprises me is that I thought .Display made the process Modal and would stop until sent or canceled but the code after .Display just kept on chugging away.
>
Patrick,
Try:
.Display True
first... to make the pop-up modal, then take a look at the:
.Sent
property. Read only. Should be 0 once the email has been sent. Something
along the lines of:
Dim breakout As Long
Dim answer As Integer
breakout = 1
Do While objOutlookMsg.Sent = 1
DoEvents
'wait 1 second
Application.Wait(Now + #0:00:01#)
'count 10 seconds
breakout = breakout + 1
If (breakout = 10) Then
answer = MsgBox("Email has not been sent yet!" & vbCrLf & "Continue
waiting?", vbYesNo + vbExclamation +
vbDefaultButton1 + vbApplicationModal +
vbMsgBoxSetForeground, "Email pending.")
If (answer = vbNo) Then
' do not want to keep waiting... get out of the loop
MsgBox "Please send the email manually.", vbOkOnly + vbCritical +
vbApplicationModal + vbMsgBoxSetForeground, "Email
pending."
Exit Do
Else
'want to keep waiting... reset counter to 1 and wait again.
breakout = 1
End If
Loop
Completely untested but should move you in the right direction. The
idea is that this code would wait for the email to be sent whether it
was sent by .Send or by manually clicking the Send button with an alert
every 10 seconds. There are no *continuation* lines so sorry if the
formatting is messed up (formatted for readability here.) If you use
this code, verify the value of .Sent (MsgBox objOutlookMsg.Sent) prior
to .Send in your current code before adding this code. I'm thinking it
should be equal to 1 (non-zero?) but I could have it backwards. I
deleted my original code because I could not use .Send due to security
warnings.
--
Norman
Registered Linux user #461062
AMD64X2 6400+ Ubuntu 10.04 64bit
[toc] | [prev] | [next] | [standalone]
| From | Patrick Finucane <patrickfinucanetx@gmail.com> |
|---|---|
| Date | 2014-10-06 06:25 -0700 |
| Message-ID | <1f380ec1-fd5f-4abd-9ade-b56b5293d920@googlegroups.com> |
| In reply to | #9975 |
On Saturday, October 4, 2014 8:58:38 AM UTC-4, Norman Peelman wrote:
> On 10/03/2014 09:06 AM, Patrick Finucane wrote:
>
> > On Thursday, October 2, 2014 7:52:36 PM UTC-4, Norman Peelman wrote:
>
> >> On 10/02/2014 01:59 PM, Patrick Finucane wrote:
>
> >>
>
> >>> I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this
>
> >>
>
> >>> If DisplayEmail Then
>
> >>
>
> >>> .Display
>
> >>
>
> >>> Else
>
> >>
>
> >>> .Save
>
> >>
>
> >>> .Send
>
> >>
>
> >>> End If
>
> >>
>
> >>>
>
> >>
>
> >>> After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message.
>
> >>
>
> >>>
>
> >>
>
> >>> How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly.
>
> >>
>
> >>>
>
> >>
>
> >>
>
> >>
>
> >> If Outlook isn't open then how will you see the Inbox? I think
>
> >>
>
> >> you'll find that your email is being sent just fine. You are only
>
> >>
>
> >> dealing with the *new message* window at this point. And unless you have
>
> >>
>
> >> certain security features turned off, you may find that your ELSE
>
> >>
>
> >> statement fails on the .Send command.
>
> >>
>
> >>
>
> >>
>
> >>
>
> >>
>
> >> --
>
> >>
>
> >> Norman
>
> >>
>
> >> Registered Linux user #461062
>
> >>
>
> >> AMD64X2 6400+ Ubuntu 10.04 64bit
>
> >
>
> > OK. I send the message to my GMail account. I send it via Outlook. I have my web browser opened to Gmail. I can wait an hour or two and no msg. When I open Outlook, I get the msg in Gmail immediately.
>
> >
>
> > What surprises me is that I thought .Display made the process Modal and would stop until sent or canceled but the code after .Display just kept on chugging away.
>
> >
>
>
>
> Patrick,
>
>
>
> Try:
>
>
>
> .Display True
>
>
>
> first... to make the pop-up modal, then take a look at the:
>
>
>
> .Sent
>
>
>
> property. Read only. Should be 0 once the email has been sent. Something
>
> along the lines of:
>
>
>
>
>
> Dim breakout As Long
>
> Dim answer As Integer
>
> breakout = 1
>
> Do While objOutlookMsg.Sent = 1
>
> DoEvents
>
> 'wait 1 second
>
> Application.Wait(Now + #0:00:01#)
>
> 'count 10 seconds
>
> breakout = breakout + 1
>
> If (breakout = 10) Then
>
> answer = MsgBox("Email has not been sent yet!" & vbCrLf & "Continue
>
> waiting?", vbYesNo + vbExclamation +
>
> vbDefaultButton1 + vbApplicationModal +
>
> vbMsgBoxSetForeground, "Email pending.")
>
> If (answer = vbNo) Then
>
> ' do not want to keep waiting... get out of the loop
>
> MsgBox "Please send the email manually.", vbOkOnly + vbCritical +
>
> vbApplicationModal + vbMsgBoxSetForeground, "Email
>
> pending."
>
> Exit Do
>
> Else
>
> 'want to keep waiting... reset counter to 1 and wait again.
>
> breakout = 1
>
> End If
>
> Loop
>
>
>
>
>
> Completely untested but should move you in the right direction. The
>
> idea is that this code would wait for the email to be sent whether it
>
> was sent by .Send or by manually clicking the Send button with an alert
>
> every 10 seconds. There are no *continuation* lines so sorry if the
>
> formatting is messed up (formatted for readability here.) If you use
>
> this code, verify the value of .Sent (MsgBox objOutlookMsg.Sent) prior
>
> to .Send in your current code before adding this code. I'm thinking it
>
> should be equal to 1 (non-zero?) but I could have it backwards. I
>
> deleted my original code because I could not use .Send due to security
>
> warnings.
>
>
>
>
>
>
>
> --
>
> Norman
>
> Registered Linux user #461062
>
> AMD64X2 6400+ Ubuntu 10.04 64bit
I put in Display True. No change. Access is oblivious to a modal window. This must be a new improvement to Access 2013. I guess the best solution is to tell the ops to keep Outlook open anytime they send an email otherwise it will never get sent.
[toc] | [prev] | [next] | [standalone]
| From | JB Guernsey <jeff@angelsystems.co.uk> |
|---|---|
| Date | 2014-10-06 07:58 -0700 |
| Message-ID | <586e1209-2848-4457-817a-492866feb204@googlegroups.com> |
| In reply to | #9980 |
On Monday, October 6, 2014 2:25:56 PM UTC+1, Patrick Finucane wrote:
> On Saturday, October 4, 2014 8:58:38 AM UTC-4, Norman Peelman wrote:
>
> > On 10/03/2014 09:06 AM, Patrick Finucane wrote:
>
> >
>
> > > On Thursday, October 2, 2014 7:52:36 PM UTC-4, Norman Peelman wrote:
>
> >
>
> > >> On 10/02/2014 01:59 PM, Patrick Finucane wrote:
>
> >
>
> > >>
>
> >
>
> > >>> I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this
>
> >
>
> > >>
>
> >
>
> > >>> If DisplayEmail Then
>
> >
>
> > >>
>
> >
>
> > >>> .Display
>
> >
>
> > >>
>
> >
>
> > >>> Else
>
> >
>
> > >>
>
> >
>
> > >>> .Save
>
> >
>
> > >>
>
> >
>
> > >>> .Send
>
> >
>
> > >>
>
> >
>
> > >>> End If
>
> >
>
> > >>
>
> >
>
> > >>>
>
> >
>
> > >>
>
> >
>
> > >>> After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message.
>
> >
>
> > >>
>
> >
>
> > >>>
>
> >
>
> > >>
>
> >
>
> > >>> How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly.
>
> >
>
> > >>
>
> >
>
> > >>>
>
> >
>
> > >>
>
> >
>
> > >>
>
> >
>
> > >>
>
> >
>
> > >> If Outlook isn't open then how will you see the Inbox? I think
>
> >
>
> > >>
>
> >
>
> > >> you'll find that your email is being sent just fine. You are only
>
> >
>
> > >>
>
> >
>
> > >> dealing with the *new message* window at this point. And unless you have
>
> >
>
> > >>
>
> >
>
> > >> certain security features turned off, you may find that your ELSE
>
> >
>
> > >>
>
> >
>
> > >> statement fails on the .Send command.
>
> >
>
> > >>
>
> >
>
> > >>
>
> >
>
> > >>
>
> >
>
> > >>
>
> >
>
> > >>
>
> >
>
> > >> --
>
> >
>
> > >>
>
> >
>
> > >> Norman
>
> >
>
> > >>
>
> >
>
> > >> Registered Linux user #461062
>
> >
>
> > >>
>
> >
>
> > >> AMD64X2 6400+ Ubuntu 10.04 64bit
>
> >
>
> > >
>
> >
>
> > > OK. I send the message to my GMail account. I send it via Outlook. I have my web browser opened to Gmail. I can wait an hour or two and no msg. When I open Outlook, I get the msg in Gmail immediately.
>
> >
>
> > >
>
> >
>
> > > What surprises me is that I thought .Display made the process Modal and would stop until sent or canceled but the code after .Display just kept on chugging away.
>
> >
>
> > >
>
> >
>
> >
>
> >
>
> > Patrick,
>
> >
>
> >
>
> >
>
> > Try:
>
> >
>
> >
>
> >
>
> > .Display True
>
> >
>
> >
>
> >
>
> > first... to make the pop-up modal, then take a look at the:
>
> >
>
> >
>
> >
>
> > .Sent
>
> >
>
> >
>
> >
>
> > property. Read only. Should be 0 once the email has been sent. Something
>
> >
>
> > along the lines of:
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > Dim breakout As Long
>
> >
>
> > Dim answer As Integer
>
> >
>
> > breakout = 1
>
> >
>
> > Do While objOutlookMsg.Sent = 1
>
> >
>
> > DoEvents
>
> >
>
> > 'wait 1 second
>
> >
>
> > Application.Wait(Now + #0:00:01#)
>
> >
>
> > 'count 10 seconds
>
> >
>
> > breakout = breakout + 1
>
> >
>
> > If (breakout = 10) Then
>
> >
>
> > answer = MsgBox("Email has not been sent yet!" & vbCrLf & "Continue
>
> >
>
> > waiting?", vbYesNo + vbExclamation +
>
> >
>
> > vbDefaultButton1 + vbApplicationModal +
>
> >
>
> > vbMsgBoxSetForeground, "Email pending.")
>
> >
>
> > If (answer = vbNo) Then
>
> >
>
> > ' do not want to keep waiting... get out of the loop
>
> >
>
> > MsgBox "Please send the email manually.", vbOkOnly + vbCritical +
>
> >
>
> > vbApplicationModal + vbMsgBoxSetForeground, "Email
>
> >
>
> > pending."
>
> >
>
> > Exit Do
>
> >
>
> > Else
>
> >
>
> > 'want to keep waiting... reset counter to 1 and wait again.
>
> >
>
> > breakout = 1
>
> >
>
> > End If
>
> >
>
> > Loop
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > Completely untested but should move you in the right direction. The
>
> >
>
> > idea is that this code would wait for the email to be sent whether it
>
> >
>
> > was sent by .Send or by manually clicking the Send button with an alert
>
> >
>
> > every 10 seconds. There are no *continuation* lines so sorry if the
>
> >
>
> > formatting is messed up (formatted for readability here.) If you use
>
> >
>
> > this code, verify the value of .Sent (MsgBox objOutlookMsg.Sent) prior
>
> >
>
> > to .Send in your current code before adding this code. I'm thinking it
>
> >
>
> > should be equal to 1 (non-zero?) but I could have it backwards. I
>
> >
>
> > deleted my original code because I could not use .Send due to security
>
> >
>
> > warnings.
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > --
>
> >
>
> > Norman
>
> >
>
> > Registered Linux user #461062
>
> >
>
> > AMD64X2 6400+ Ubuntu 10.04 64bit
>
>
>
> I put in Display True. No change. Access is oblivious to a modal window. This must be a new improvement to Access 2013. I guess the best solution is to tell the ops to keep Outlook open anytime they send an email otherwise it will never get sent.
Hi Patrick.
I use 2013 (see below). I open a (modal) form to collect email data and then call the following on the click event of a Send button ...
Public Function SendEmailfromOutlook()
If IsNull(Forms!frmEmail!AddressBox) Then
MsgBox "You must provide an EMail Address!"
Exit Function
End If
If IsNull(Forms!frmEmail!SubjectBox) Then
MsgBox "You must provide a Subject!"
Exit Function
End If
If IsNull(Forms!frmEmail!MessageBox) Then
MsgBox "You must provide a Message!"
Exit Function
End If
Dim rsAttach As Recordset
Dim objOutlook As Object
Dim objOutlookMsg As Object
Dim objOutLookRecip As Object
Dim objOutLookAttach As Object
Dim strEmailTo As String
Dim strSubject As String
Dim strMsgTxt As String
Dim strAttachment As String
strSubject = Forms!frmEmail!SubjectBox
strMsgTxt = Forms!frmEmail!MessageBox
DoCmd.Echo False
DoCmd.Hourglass True
'Create the Outlook session.
On Error GoTo My_Err
Set objOutlook = CreateObject("Outlook.Application")
DoEvents
' Create the message object
Set objOutlookMsg = objOutlook.CreateItem(0) ' 0 = olMainItem
DoEvents
With objOutlookMsg
.To = Forms!frmEmail!AddressBox
.Subject = strSubject
.Body = strMsgTxt & vbCrLf
'.Attachments.Add ("C:\OfficeAngelKF\Quote" & Forms!frmQuotes!QuoteID & ".pdf")
.Importance = 1 'Std importance
Set rsAttach = CurrentDb.OpenRecordset("tblFileNames", dbOpenDynaset)
If Not rsAttach.RecordCount = 0 Then
rsAttach.MoveFirst
Do Until rsAttach.EOF
If rsAttach!Selected = True Then
.Attachments.Add (rsAttach!FilePathandName)
End If
rsAttach.MoveNext
Loop
End If
.send
DoEvents
Call LogEmail(Forms!frmEmail!AddressBox, strSubject, strMsgTxt)
End With
DoCmd.Echo True
DoCmd.Hourglass False
MsgBox "Email sent to Outlook.", vbInformation, "Notification"
Exit Function
My_Err:
DoCmd.Echo True
DoCmd.Hourglass False
MsgBox Err.Number & " ... " & Err.Description
Err = 0
End Function
This is late binding.
Attachments are previously selected and the path(s) are stored in tblFilenames. The attachments are placed into a folder called OfficeAngelKF.
It works fine.
I also have a function that sends emails without using Outlook.
HTH
JB
[toc] | [prev] | [next] | [standalone]
| From | Patrick Finucane <patrickfinucanetx@gmail.com> |
|---|---|
| Date | 2014-10-06 09:27 -0700 |
| Message-ID | <1929c546-09d1-4474-83c3-d23fd14a696d@googlegroups.com> |
| In reply to | #9982 |
On Monday, October 6, 2014 10:58:49 AM UTC-4, JB Guernsey wrote:
> On Monday, October 6, 2014 2:25:56 PM UTC+1, Patrick Finucane wrote:
>
> > On Saturday, October 4, 2014 8:58:38 AM UTC-4, Norman Peelman wrote:
>
> >
>
> > > On 10/03/2014 09:06 AM, Patrick Finucane wrote:
>
> >
>
> > >
>
> >
>
> > > > On Thursday, October 2, 2014 7:52:36 PM UTC-4, Norman Peelman wrote:
>
> >
>
> > >
>
> >
>
> > > >> On 10/02/2014 01:59 PM, Patrick Finucane wrote:
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>> I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>> If DisplayEmail Then
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>> .Display
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>> Else
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>> .Save
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>> .Send
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>> End If
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>>
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>> After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message.
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>>
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>> How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly.
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>>
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >> If Outlook isn't open then how will you see the Inbox? I think
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >> you'll find that your email is being sent just fine. You are only
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >> dealing with the *new message* window at this point. And unless you have
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >> certain security features turned off, you may find that your ELSE
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >> statement fails on the .Send command.
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >> --
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >> Norman
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >> Registered Linux user #461062
>
> >
>
> > >
>
> >
>
> > > >>
>
> >
>
> > >
>
> >
>
> > > >> AMD64X2 6400+ Ubuntu 10.04 64bit
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > OK. I send the message to my GMail account. I send it via Outlook. I have my web browser opened to Gmail. I can wait an hour or two and no msg. When I open Outlook, I get the msg in Gmail immediately.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > What surprises me is that I thought .Display made the process Modal and would stop until sent or canceled but the code after .Display just kept on chugging away.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Patrick,
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Try:
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > .Display True
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > first... to make the pop-up modal, then take a look at the:
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > .Sent
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > property. Read only. Should be 0 once the email has been sent. Something
>
> >
>
> > >
>
> >
>
> > > along the lines of:
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Dim breakout As Long
>
> >
>
> > >
>
> >
>
> > > Dim answer As Integer
>
> >
>
> > >
>
> >
>
> > > breakout = 1
>
> >
>
> > >
>
> >
>
> > > Do While objOutlookMsg.Sent = 1
>
> >
>
> > >
>
> >
>
> > > DoEvents
>
> >
>
> > >
>
> >
>
> > > 'wait 1 second
>
> >
>
> > >
>
> >
>
> > > Application.Wait(Now + #0:00:01#)
>
> >
>
> > >
>
> >
>
> > > 'count 10 seconds
>
> >
>
> > >
>
> >
>
> > > breakout = breakout + 1
>
> >
>
> > >
>
> >
>
> > > If (breakout = 10) Then
>
> >
>
> > >
>
> >
>
> > > answer = MsgBox("Email has not been sent yet!" & vbCrLf & "Continue
>
> >
>
> > >
>
> >
>
> > > waiting?", vbYesNo + vbExclamation +
>
> >
>
> > >
>
> >
>
> > > vbDefaultButton1 + vbApplicationModal +
>
> >
>
> > >
>
> >
>
> > > vbMsgBoxSetForeground, "Email pending.")
>
> >
>
> > >
>
> >
>
> > > If (answer = vbNo) Then
>
> >
>
> > >
>
> >
>
> > > ' do not want to keep waiting... get out of the loop
>
> >
>
> > >
>
> >
>
> > > MsgBox "Please send the email manually.", vbOkOnly + vbCritical +
>
> >
>
> > >
>
> >
>
> > > vbApplicationModal + vbMsgBoxSetForeground, "Email
>
> >
>
> > >
>
> >
>
> > > pending."
>
> >
>
> > >
>
> >
>
> > > Exit Do
>
> >
>
> > >
>
> >
>
> > > Else
>
> >
>
> > >
>
> >
>
> > > 'want to keep waiting... reset counter to 1 and wait again.
>
> >
>
> > >
>
> >
>
> > > breakout = 1
>
> >
>
> > >
>
> >
>
> > > End If
>
> >
>
> > >
>
> >
>
> > > Loop
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Completely untested but should move you in the right direction. The
>
> >
>
> > >
>
> >
>
> > > idea is that this code would wait for the email to be sent whether it
>
> >
>
> > >
>
> >
>
> > > was sent by .Send or by manually clicking the Send button with an alert
>
> >
>
> > >
>
> >
>
> > > every 10 seconds. There are no *continuation* lines so sorry if the
>
> >
>
> > >
>
> >
>
> > > formatting is messed up (formatted for readability here.) If you use
>
> >
>
> > >
>
> >
>
> > > this code, verify the value of .Sent (MsgBox objOutlookMsg.Sent) prior
>
> >
>
> > >
>
> >
>
> > > to .Send in your current code before adding this code. I'm thinking it
>
> >
>
> > >
>
> >
>
> > > should be equal to 1 (non-zero?) but I could have it backwards. I
>
> >
>
> > >
>
> >
>
> > > deleted my original code because I could not use .Send due to security
>
> >
>
> > >
>
> >
>
> > > warnings.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > --
>
> >
>
> > >
>
> >
>
> > > Norman
>
> >
>
> > >
>
> >
>
> > > Registered Linux user #461062
>
> >
>
> > >
>
> >
>
> > > AMD64X2 6400+ Ubuntu 10.04 64bit
>
> >
>
> >
>
> >
>
> > I put in Display True. No change. Access is oblivious to a modal window. This must be a new improvement to Access 2013. I guess the best solution is to tell the ops to keep Outlook open anytime they send an email otherwise it will never get sent.
>
>
>
> Hi Patrick.
>
>
>
> I use 2013 (see below). I open a (modal) form to collect email data and then call the following on the click event of a Send button ...
>
>
>
> Public Function SendEmailfromOutlook()
>
> If IsNull(Forms!frmEmail!AddressBox) Then
>
> MsgBox "You must provide an EMail Address!"
>
> Exit Function
>
> End If
>
>
>
> If IsNull(Forms!frmEmail!SubjectBox) Then
>
> MsgBox "You must provide a Subject!"
>
> Exit Function
>
> End If
>
> If IsNull(Forms!frmEmail!MessageBox) Then
>
> MsgBox "You must provide a Message!"
>
> Exit Function
>
> End If
>
>
>
> Dim rsAttach As Recordset
>
> Dim objOutlook As Object
>
> Dim objOutlookMsg As Object
>
> Dim objOutLookRecip As Object
>
> Dim objOutLookAttach As Object
>
> Dim strEmailTo As String
>
> Dim strSubject As String
>
> Dim strMsgTxt As String
>
> Dim strAttachment As String
>
>
>
> strSubject = Forms!frmEmail!SubjectBox
>
> strMsgTxt = Forms!frmEmail!MessageBox
>
>
>
> DoCmd.Echo False
>
> DoCmd.Hourglass True
>
> 'Create the Outlook session.
>
> On Error GoTo My_Err
>
>
>
> Set objOutlook = CreateObject("Outlook.Application")
>
> DoEvents
>
> ' Create the message object
>
> Set objOutlookMsg = objOutlook.CreateItem(0) ' 0 = olMainItem
>
> DoEvents
>
>
>
> With objOutlookMsg
>
> .To = Forms!frmEmail!AddressBox
>
> .Subject = strSubject
>
> .Body = strMsgTxt & vbCrLf
>
> '.Attachments.Add ("C:\OfficeAngelKF\Quote" & Forms!frmQuotes!QuoteID & ".pdf")
>
> .Importance = 1 'Std importance
>
> Set rsAttach = CurrentDb.OpenRecordset("tblFileNames", dbOpenDynaset)
>
> If Not rsAttach.RecordCount = 0 Then
>
> rsAttach.MoveFirst
>
> Do Until rsAttach.EOF
>
> If rsAttach!Selected = True Then
>
> .Attachments.Add (rsAttach!FilePathandName)
>
> End If
>
> rsAttach.MoveNext
>
> Loop
>
> End If
>
> .send
>
> DoEvents
>
> Call LogEmail(Forms!frmEmail!AddressBox, strSubject, strMsgTxt)
>
> End With
>
>
>
> DoCmd.Echo True
>
> DoCmd.Hourglass False
>
> MsgBox "Email sent to Outlook.", vbInformation, "Notification"
>
> Exit Function
>
>
>
> My_Err:
>
> DoCmd.Echo True
>
> DoCmd.Hourglass False
>
> MsgBox Err.Number & " ... " & Err.Description
>
> Err = 0
>
> End Function
>
>
>
> This is late binding.
>
>
>
> Attachments are previously selected and the path(s) are stored in tblFilenames. The attachments are placed into a folder called OfficeAngelKF.
>
>
>
> It works fine.
>
>
>
> I also have a function that sends emails without using Outlook.
>
>
>
> HTH
>
>
>
> JB
I was thinking of displaying the email to the end user. The Email would open up and the OP would either press Send or close the window and cancel.
I have a .Display True and by setting to true the Email is presented as modal. Thanks Norman. If the OP presses Send in Outlook, the window closes and finishes the code and does not send the message. If I close the window and cancel the email, no error routine is run. It too will not send the message which is correct. However, if I pressed Send, I must then open up Outlook in order for the email to be sent.
This is odd to me. In the past, if I pressed Send, the email would be sent. If I closed the email and canceled it, the error routine would fire. No error routine ever fires. No emails get sent...unless I keep Outlook open. I never had this issue with A2010. A2013 is a new game with differences.
[toc] | [prev] | [next] | [standalone]
| From | JB Guernsey <jeff@angelsystems.co.uk> |
|---|---|
| Date | 2014-10-06 10:24 -0700 |
| Message-ID | <749c656f-290b-41eb-818f-7c1d8a77db62@googlegroups.com> |
| In reply to | #9983 |
On Monday, October 6, 2014 5:27:20 PM UTC+1, Patrick Finucane wrote:
> On Monday, October 6, 2014 10:58:49 AM UTC-4, JB Guernsey wrote:
>
> > On Monday, October 6, 2014 2:25:56 PM UTC+1, Patrick Finucane wrote:
>
> >
>
> > > On Saturday, October 4, 2014 8:58:38 AM UTC-4, Norman Peelman wrote:
>
> >
>
> > >
>
> >
>
> > > > On 10/03/2014 09:06 AM, Patrick Finucane wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > On Thursday, October 2, 2014 7:52:36 PM UTC-4, Norman Peelman wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >> On 10/02/2014 01:59 PM, Patrick Finucane wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>> I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>> If DisplayEmail Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>> .Display
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>> Else
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>> .Save
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>> .Send
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>> End If
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>> After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>> How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >> If Outlook isn't open then how will you see the Inbox? I think
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >> you'll find that your email is being sent just fine. You are only
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >> dealing with the *new message* window at this point. And unless you have
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >> certain security features turned off, you may find that your ELSE
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >> statement fails on the .Send command.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >> --
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >> Norman
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >> Registered Linux user #461062
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >> AMD64X2 6400+ Ubuntu 10.04 64bit
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > OK. I send the message to my GMail account. I send it via Outlook. I have my web browser opened to Gmail. I can wait an hour or two and no msg. When I open Outlook, I get the msg in Gmail immediately.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > What surprises me is that I thought .Display made the process Modal and would stop until sent or canceled but the code after .Display just kept on chugging away.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Patrick,
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Try:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > .Display True
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > first... to make the pop-up modal, then take a look at the:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > .Sent
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > property. Read only. Should be 0 once the email has been sent. Something
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > along the lines of:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Dim breakout As Long
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Dim answer As Integer
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > breakout = 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Do While objOutlookMsg.Sent = 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > DoEvents
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > 'wait 1 second
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Application.Wait(Now + #0:00:01#)
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > 'count 10 seconds
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > breakout = breakout + 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > If (breakout = 10) Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > answer = MsgBox("Email has not been sent yet!" & vbCrLf & "Continue
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > waiting?", vbYesNo + vbExclamation +
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > vbDefaultButton1 + vbApplicationModal +
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > vbMsgBoxSetForeground, "Email pending.")
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > If (answer = vbNo) Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > ' do not want to keep waiting... get out of the loop
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > MsgBox "Please send the email manually.", vbOkOnly + vbCritical +
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > vbApplicationModal + vbMsgBoxSetForeground, "Email
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > pending."
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Exit Do
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Else
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > 'want to keep waiting... reset counter to 1 and wait again.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > breakout = 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > End If
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Loop
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Completely untested but should move you in the right direction. The
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > idea is that this code would wait for the email to be sent whether it
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > was sent by .Send or by manually clicking the Send button with an alert
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > every 10 seconds. There are no *continuation* lines so sorry if the
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > formatting is messed up (formatted for readability here.) If you use
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > this code, verify the value of .Sent (MsgBox objOutlookMsg.Sent) prior
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > to .Send in your current code before adding this code. I'm thinking it
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > should be equal to 1 (non-zero?) but I could have it backwards. I
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > deleted my original code because I could not use .Send due to security
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > warnings.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > --
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Norman
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Registered Linux user #461062
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > AMD64X2 6400+ Ubuntu 10.04 64bit
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > I put in Display True. No change. Access is oblivious to a modal window. This must be a new improvement to Access 2013. I guess the best solution is to tell the ops to keep Outlook open anytime they send an email otherwise it will never get sent.
>
> >
>
> >
>
> >
>
> > Hi Patrick.
>
> >
>
> >
>
> >
>
> > I use 2013 (see below). I open a (modal) form to collect email data and then call the following on the click event of a Send button ...
>
> >
>
> >
>
> >
>
> > Public Function SendEmailfromOutlook()
>
> >
>
> > If IsNull(Forms!frmEmail!AddressBox) Then
>
> >
>
> > MsgBox "You must provide an EMail Address!"
>
> >
>
> > Exit Function
>
> >
>
> > End If
>
> >
>
> >
>
> >
>
> > If IsNull(Forms!frmEmail!SubjectBox) Then
>
> >
>
> > MsgBox "You must provide a Subject!"
>
> >
>
> > Exit Function
>
> >
>
> > End If
>
> >
>
> > If IsNull(Forms!frmEmail!MessageBox) Then
>
> >
>
> > MsgBox "You must provide a Message!"
>
> >
>
> > Exit Function
>
> >
>
> > End If
>
> >
>
> >
>
> >
>
> > Dim rsAttach As Recordset
>
> >
>
> > Dim objOutlook As Object
>
> >
>
> > Dim objOutlookMsg As Object
>
> >
>
> > Dim objOutLookRecip As Object
>
> >
>
> > Dim objOutLookAttach As Object
>
> >
>
> > Dim strEmailTo As String
>
> >
>
> > Dim strSubject As String
>
> >
>
> > Dim strMsgTxt As String
>
> >
>
> > Dim strAttachment As String
>
> >
>
> >
>
> >
>
> > strSubject = Forms!frmEmail!SubjectBox
>
> >
>
> > strMsgTxt = Forms!frmEmail!MessageBox
>
> >
>
> >
>
> >
>
> > DoCmd.Echo False
>
> >
>
> > DoCmd.Hourglass True
>
> >
>
> > 'Create the Outlook session.
>
> >
>
> > On Error GoTo My_Err
>
> >
>
> >
>
> >
>
> > Set objOutlook = CreateObject("Outlook.Application")
>
> >
>
> > DoEvents
>
> >
>
> > ' Create the message object
>
> >
>
> > Set objOutlookMsg = objOutlook.CreateItem(0) ' 0 = olMainItem
>
> >
>
> > DoEvents
>
> >
>
> >
>
> >
>
> > With objOutlookMsg
>
> >
>
> > .To = Forms!frmEmail!AddressBox
>
> >
>
> > .Subject = strSubject
>
> >
>
> > .Body = strMsgTxt & vbCrLf
>
> >
>
> > '.Attachments.Add ("C:\OfficeAngelKF\Quote" & Forms!frmQuotes!QuoteID & ".pdf")
>
> >
>
> > .Importance = 1 'Std importance
>
> >
>
> > Set rsAttach = CurrentDb.OpenRecordset("tblFileNames", dbOpenDynaset)
>
> >
>
> > If Not rsAttach.RecordCount = 0 Then
>
> >
>
> > rsAttach.MoveFirst
>
> >
>
> > Do Until rsAttach.EOF
>
> >
>
> > If rsAttach!Selected = True Then
>
> >
>
> > .Attachments.Add (rsAttach!FilePathandName)
>
> >
>
> > End If
>
> >
>
> > rsAttach.MoveNext
>
> >
>
> > Loop
>
> >
>
> > End If
>
> >
>
> > .send
>
> >
>
> > DoEvents
>
> >
>
> > Call LogEmail(Forms!frmEmail!AddressBox, strSubject, strMsgTxt)
>
> >
>
> > End With
>
> >
>
> >
>
> >
>
> > DoCmd.Echo True
>
> >
>
> > DoCmd.Hourglass False
>
> >
>
> > MsgBox "Email sent to Outlook.", vbInformation, "Notification"
>
> >
>
> > Exit Function
>
> >
>
> >
>
> >
>
> > My_Err:
>
> >
>
> > DoCmd.Echo True
>
> >
>
> > DoCmd.Hourglass False
>
> >
>
> > MsgBox Err.Number & " ... " & Err.Description
>
> >
>
> > Err = 0
>
> >
>
> > End Function
>
> >
>
> >
>
> >
>
> > This is late binding.
>
> >
>
> >
>
> >
>
> > Attachments are previously selected and the path(s) are stored in tblFilenames. The attachments are placed into a folder called OfficeAngelKF.
>
> >
>
> >
>
> >
>
> > It works fine.
>
> >
>
> >
>
> >
>
> > I also have a function that sends emails without using Outlook.
>
> >
>
> >
>
> >
>
> > HTH
>
> >
>
> >
>
> >
>
> > JB
>
>
>
> I was thinking of displaying the email to the end user. The Email would open up and the OP would either press Send or close the window and cancel.
>
>
>
> I have a .Display True and by setting to true the Email is presented as modal. Thanks Norman. If the OP presses Send in Outlook, the window closes and finishes the code and does not send the message. If I close the window and cancel the email, no error routine is run. It too will not send the message which is correct. However, if I pressed Send, I must then open up Outlook in order for the email to be sent.
>
>
>
> This is odd to me. In the past, if I pressed Send, the email would be sent. If I closed the email and canceled it, the error routine would fire. No error routine ever fires. No emails get sent...unless I keep Outlook open. I never had this issue with A2010. A2013 is a new game with differences.
I forgot to mention. I have my Outlook (Office 2013 version)set so that it does not send emails as soon as they arrive in the outbox. I have to do a send and receive (in Outlook) to send them but I believe that they would automatically go if I changed my Outlook settings.
JB
[toc] | [prev] | [next] | [standalone]
| From | Patrick Finucane <patrickfinucanetx@gmail.com> |
|---|---|
| Date | 2014-10-06 10:35 -0700 |
| Message-ID | <83458cfd-3278-467a-b58a-dfc6bff8864a@googlegroups.com> |
| In reply to | #9984 |
On Monday, October 6, 2014 1:24:09 PM UTC-4, JB Guernsey wrote:
> On Monday, October 6, 2014 5:27:20 PM UTC+1, Patrick Finucane wrote:
>
> > On Monday, October 6, 2014 10:58:49 AM UTC-4, JB Guernsey wrote:
>
> >
>
> > > On Monday, October 6, 2014 2:25:56 PM UTC+1, Patrick Finucane wrote:
>
> >
>
> > >
>
> >
>
> > > > On Saturday, October 4, 2014 8:58:38 AM UTC-4, Norman Peelman wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > On 10/03/2014 09:06 AM, Patrick Finucane wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > On Thursday, October 2, 2014 7:52:36 PM UTC-4, Norman Peelman wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >> On 10/02/2014 01:59 PM, Patrick Finucane wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>> I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>> If DisplayEmail Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>> .Display
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>> Else
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>> .Save
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>> .Send
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>> End If
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>> After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>> How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >> If Outlook isn't open then how will you see the Inbox? I think
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >> you'll find that your email is being sent just fine. You are only
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >> dealing with the *new message* window at this point. And unless you have
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >> certain security features turned off, you may find that your ELSE
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >> statement fails on the .Send command.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >> --
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >> Norman
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >> Registered Linux user #461062
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >> AMD64X2 6400+ Ubuntu 10.04 64bit
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > OK. I send the message to my GMail account. I send it via Outlook. I have my web browser opened to Gmail. I can wait an hour or two and no msg. When I open Outlook, I get the msg in Gmail immediately.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > What surprises me is that I thought .Display made the process Modal and would stop until sent or canceled but the code after .Display just kept on chugging away.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Patrick,
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Try:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > .Display True
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > first... to make the pop-up modal, then take a look at the:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > .Sent
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > property. Read only. Should be 0 once the email has been sent. Something
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > along the lines of:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Dim breakout As Long
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Dim answer As Integer
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > breakout = 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Do While objOutlookMsg.Sent = 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > DoEvents
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > 'wait 1 second
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Application.Wait(Now + #0:00:01#)
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > 'count 10 seconds
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > breakout = breakout + 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > If (breakout = 10) Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > answer = MsgBox("Email has not been sent yet!" & vbCrLf & "Continue
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > waiting?", vbYesNo + vbExclamation +
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > vbDefaultButton1 + vbApplicationModal +
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > vbMsgBoxSetForeground, "Email pending.")
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > If (answer = vbNo) Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > ' do not want to keep waiting... get out of the loop
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > MsgBox "Please send the email manually.", vbOkOnly + vbCritical +
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > vbApplicationModal + vbMsgBoxSetForeground, "Email
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > pending."
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Exit Do
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Else
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > 'want to keep waiting... reset counter to 1 and wait again.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > breakout = 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > End If
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Loop
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Completely untested but should move you in the right direction. The
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > idea is that this code would wait for the email to be sent whether it
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > was sent by .Send or by manually clicking the Send button with an alert
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > every 10 seconds. There are no *continuation* lines so sorry if the
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > formatting is messed up (formatted for readability here.) If you use
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > this code, verify the value of .Sent (MsgBox objOutlookMsg.Sent) prior
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > to .Send in your current code before adding this code. I'm thinking it
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > should be equal to 1 (non-zero?) but I could have it backwards. I
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > deleted my original code because I could not use .Send due to security
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > warnings.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > --
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Norman
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > Registered Linux user #461062
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > AMD64X2 6400+ Ubuntu 10.04 64bit
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > I put in Display True. No change. Access is oblivious to a modal window. This must be a new improvement to Access 2013. I guess the best solution is to tell the ops to keep Outlook open anytime they send an email otherwise it will never get sent.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Hi Patrick.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > I use 2013 (see below). I open a (modal) form to collect email data and then call the following on the click event of a Send button ...
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Public Function SendEmailfromOutlook()
>
> >
>
> > >
>
> >
>
> > > If IsNull(Forms!frmEmail!AddressBox) Then
>
> >
>
> > >
>
> >
>
> > > MsgBox "You must provide an EMail Address!"
>
> >
>
> > >
>
> >
>
> > > Exit Function
>
> >
>
> > >
>
> >
>
> > > End If
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > If IsNull(Forms!frmEmail!SubjectBox) Then
>
> >
>
> > >
>
> >
>
> > > MsgBox "You must provide a Subject!"
>
> >
>
> > >
>
> >
>
> > > Exit Function
>
> >
>
> > >
>
> >
>
> > > End If
>
> >
>
> > >
>
> >
>
> > > If IsNull(Forms!frmEmail!MessageBox) Then
>
> >
>
> > >
>
> >
>
> > > MsgBox "You must provide a Message!"
>
> >
>
> > >
>
> >
>
> > > Exit Function
>
> >
>
> > >
>
> >
>
> > > End If
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Dim rsAttach As Recordset
>
> >
>
> > >
>
> >
>
> > > Dim objOutlook As Object
>
> >
>
> > >
>
> >
>
> > > Dim objOutlookMsg As Object
>
> >
>
> > >
>
> >
>
> > > Dim objOutLookRecip As Object
>
> >
>
> > >
>
> >
>
> > > Dim objOutLookAttach As Object
>
> >
>
> > >
>
> >
>
> > > Dim strEmailTo As String
>
> >
>
> > >
>
> >
>
> > > Dim strSubject As String
>
> >
>
> > >
>
> >
>
> > > Dim strMsgTxt As String
>
> >
>
> > >
>
> >
>
> > > Dim strAttachment As String
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > strSubject = Forms!frmEmail!SubjectBox
>
> >
>
> > >
>
> >
>
> > > strMsgTxt = Forms!frmEmail!MessageBox
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > DoCmd.Echo False
>
> >
>
> > >
>
> >
>
> > > DoCmd.Hourglass True
>
> >
>
> > >
>
> >
>
> > > 'Create the Outlook session.
>
> >
>
> > >
>
> >
>
> > > On Error GoTo My_Err
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Set objOutlook = CreateObject("Outlook.Application")
>
> >
>
> > >
>
> >
>
> > > DoEvents
>
> >
>
> > >
>
> >
>
> > > ' Create the message object
>
> >
>
> > >
>
> >
>
> > > Set objOutlookMsg = objOutlook.CreateItem(0) ' 0 = olMainItem
>
> >
>
> > >
>
> >
>
> > > DoEvents
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > With objOutlookMsg
>
> >
>
> > >
>
> >
>
> > > .To = Forms!frmEmail!AddressBox
>
> >
>
> > >
>
> >
>
> > > .Subject = strSubject
>
> >
>
> > >
>
> >
>
> > > .Body = strMsgTxt & vbCrLf
>
> >
>
> > >
>
> >
>
> > > '.Attachments.Add ("C:\OfficeAngelKF\Quote" & Forms!frmQuotes!QuoteID & ".pdf")
>
> >
>
> > >
>
> >
>
> > > .Importance = 1 'Std importance
>
> >
>
> > >
>
> >
>
> > > Set rsAttach = CurrentDb.OpenRecordset("tblFileNames", dbOpenDynaset)
>
> >
>
> > >
>
> >
>
> > > If Not rsAttach.RecordCount = 0 Then
>
> >
>
> > >
>
> >
>
> > > rsAttach.MoveFirst
>
> >
>
> > >
>
> >
>
> > > Do Until rsAttach.EOF
>
> >
>
> > >
>
> >
>
> > > If rsAttach!Selected = True Then
>
> >
>
> > >
>
> >
>
> > > .Attachments.Add (rsAttach!FilePathandName)
>
> >
>
> > >
>
> >
>
> > > End If
>
> >
>
> > >
>
> >
>
> > > rsAttach.MoveNext
>
> >
>
> > >
>
> >
>
> > > Loop
>
> >
>
> > >
>
> >
>
> > > End If
>
> >
>
> > >
>
> >
>
> > > .send
>
> >
>
> > >
>
> >
>
> > > DoEvents
>
> >
>
> > >
>
> >
>
> > > Call LogEmail(Forms!frmEmail!AddressBox, strSubject, strMsgTxt)
>
> >
>
> > >
>
> >
>
> > > End With
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > DoCmd.Echo True
>
> >
>
> > >
>
> >
>
> > > DoCmd.Hourglass False
>
> >
>
> > >
>
> >
>
> > > MsgBox "Email sent to Outlook.", vbInformation, "Notification"
>
> >
>
> > >
>
> >
>
> > > Exit Function
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > My_Err:
>
> >
>
> > >
>
> >
>
> > > DoCmd.Echo True
>
> >
>
> > >
>
> >
>
> > > DoCmd.Hourglass False
>
> >
>
> > >
>
> >
>
> > > MsgBox Err.Number & " ... " & Err.Description
>
> >
>
> > >
>
> >
>
> > > Err = 0
>
> >
>
> > >
>
> >
>
> > > End Function
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > This is late binding.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Attachments are previously selected and the path(s) are stored in tblFilenames. The attachments are placed into a folder called OfficeAngelKF.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > It works fine.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > I also have a function that sends emails without using Outlook.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > HTH
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > JB
>
> >
>
> >
>
> >
>
> > I was thinking of displaying the email to the end user. The Email would open up and the OP would either press Send or close the window and cancel.
>
> >
>
> >
>
> >
>
> > I have a .Display True and by setting to true the Email is presented as modal. Thanks Norman. If the OP presses Send in Outlook, the window closes and finishes the code and does not send the message. If I close the window and cancel the email, no error routine is run. It too will not send the message which is correct. However, if I pressed Send, I must then open up Outlook in order for the email to be sent.
>
> >
>
> >
>
> >
>
> > This is odd to me. In the past, if I pressed Send, the email would be sent. If I closed the email and canceled it, the error routine would fire. No error routine ever fires. No emails get sent...unless I keep Outlook open. I never had this issue with A2010. A2013 is a new game with differences.
>
>
>
> I forgot to mention. I have my Outlook (Office 2013 version)set so that it does not send emails as soon as they arrive in the outbox. I have to do a send and receive (in Outlook) to send them but I believe that they would automatically go if I changed my Outlook settings.
>
>
>
> JB
I would not know how to change the Outlook settings. I go to File/Options/Advanced, scroll down a tad, and I have a checkbox set to Send Immediately When Connected checked. Do you know of any other settings to check?
[toc] | [prev] | [next] | [standalone]
| From | JB Guernsey <jeff@angelsystems.co.uk> |
|---|---|
| Date | 2014-10-06 13:19 -0700 |
| Message-ID | <f3592af8-b9fc-4bd5-86ec-1d4a8d06272e@googlegroups.com> |
| In reply to | #9985 |
On Monday, October 6, 2014 6:35:44 PM UTC+1, Patrick Finucane wrote:
> On Monday, October 6, 2014 1:24:09 PM UTC-4, JB Guernsey wrote:
>
> > On Monday, October 6, 2014 5:27:20 PM UTC+1, Patrick Finucane wrote:
>
> >
>
> > > On Monday, October 6, 2014 10:58:49 AM UTC-4, JB Guernsey wrote:
>
> >
>
> > >
>
> >
>
> > > > On Monday, October 6, 2014 2:25:56 PM UTC+1, Patrick Finucane wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > On Saturday, October 4, 2014 8:58:38 AM UTC-4, Norman Peelman wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > On 10/03/2014 09:06 AM, Patrick Finucane wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > > On Thursday, October 2, 2014 7:52:36 PM UTC-4, Norman Peelman wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >> On 10/02/2014 01:59 PM, Patrick Finucane wrote:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>> I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>> If DisplayEmail Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>> .Display
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>> Else
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>> .Save
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>> .Send
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>> End If
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>> After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>> How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >> If Outlook isn't open then how will you see the Inbox? I think
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >> you'll find that your email is being sent just fine. You are only
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >> dealing with the *new message* window at this point. And unless you have
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >> certain security features turned off, you may find that your ELSE
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >> statement fails on the .Send command.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >> --
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >> Norman
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >> Registered Linux user #461062
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >>
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >> AMD64X2 6400+ Ubuntu 10.04 64bit
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > > OK. I send the message to my GMail account. I send it via Outlook. I have my web browser opened to Gmail. I can wait an hour or two and no msg. When I open Outlook, I get the msg in Gmail immediately.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > > What surprises me is that I thought .Display made the process Modal and would stop until sent or canceled but the code after .Display just kept on chugging away.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Patrick,
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Try:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > .Display True
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > first... to make the pop-up modal, then take a look at the:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > .Sent
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > property. Read only. Should be 0 once the email has been sent. Something
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > along the lines of:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Dim breakout As Long
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Dim answer As Integer
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > breakout = 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Do While objOutlookMsg.Sent = 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > DoEvents
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > 'wait 1 second
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Application.Wait(Now + #0:00:01#)
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > 'count 10 seconds
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > breakout = breakout + 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > If (breakout = 10) Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > answer = MsgBox("Email has not been sent yet!" & vbCrLf & "Continue
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > waiting?", vbYesNo + vbExclamation +
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > vbDefaultButton1 + vbApplicationModal +
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > vbMsgBoxSetForeground, "Email pending.")
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > If (answer = vbNo) Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > ' do not want to keep waiting... get out of the loop
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > MsgBox "Please send the email manually.", vbOkOnly + vbCritical +
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > vbApplicationModal + vbMsgBoxSetForeground, "Email
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > pending."
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Exit Do
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Else
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > 'want to keep waiting... reset counter to 1 and wait again.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > breakout = 1
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > End If
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Loop
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Completely untested but should move you in the right direction. The
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > idea is that this code would wait for the email to be sent whether it
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > was sent by .Send or by manually clicking the Send button with an alert
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > every 10 seconds. There are no *continuation* lines so sorry if the
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > formatting is messed up (formatted for readability here.) If you use
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > this code, verify the value of .Sent (MsgBox objOutlookMsg.Sent) prior
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > to .Send in your current code before adding this code. I'm thinking it
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > should be equal to 1 (non-zero?) but I could have it backwards. I
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > deleted my original code because I could not use .Send due to security
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > warnings.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > --
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Norman
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > Registered Linux user #461062
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > > AMD64X2 6400+ Ubuntu 10.04 64bit
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > > I put in Display True. No change. Access is oblivious to a modal window. This must be a new improvement to Access 2013. I guess the best solution is to tell the ops to keep Outlook open anytime they send an email otherwise it will never get sent.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Hi Patrick.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > I use 2013 (see below). I open a (modal) form to collect email data and then call the following on the click event of a Send button ...
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Public Function SendEmailfromOutlook()
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > If IsNull(Forms!frmEmail!AddressBox) Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > MsgBox "You must provide an EMail Address!"
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Exit Function
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > End If
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > If IsNull(Forms!frmEmail!SubjectBox) Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > MsgBox "You must provide a Subject!"
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Exit Function
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > End If
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > If IsNull(Forms!frmEmail!MessageBox) Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > MsgBox "You must provide a Message!"
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Exit Function
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > End If
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Dim rsAttach As Recordset
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Dim objOutlook As Object
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Dim objOutlookMsg As Object
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Dim objOutLookRecip As Object
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Dim objOutLookAttach As Object
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Dim strEmailTo As String
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Dim strSubject As String
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Dim strMsgTxt As String
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Dim strAttachment As String
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > strSubject = Forms!frmEmail!SubjectBox
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > strMsgTxt = Forms!frmEmail!MessageBox
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > DoCmd.Echo False
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > DoCmd.Hourglass True
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > 'Create the Outlook session.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > On Error GoTo My_Err
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Set objOutlook = CreateObject("Outlook.Application")
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > DoEvents
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > ' Create the message object
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Set objOutlookMsg = objOutlook.CreateItem(0) ' 0 = olMainItem
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > DoEvents
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > With objOutlookMsg
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > .To = Forms!frmEmail!AddressBox
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > .Subject = strSubject
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > .Body = strMsgTxt & vbCrLf
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > '.Attachments.Add ("C:\OfficeAngelKF\Quote" & Forms!frmQuotes!QuoteID & ".pdf")
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > .Importance = 1 'Std importance
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Set rsAttach = CurrentDb.OpenRecordset("tblFileNames", dbOpenDynaset)
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > If Not rsAttach.RecordCount = 0 Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > rsAttach.MoveFirst
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Do Until rsAttach.EOF
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > If rsAttach!Selected = True Then
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > .Attachments.Add (rsAttach!FilePathandName)
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > End If
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > rsAttach.MoveNext
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Loop
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > End If
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > .send
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > DoEvents
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Call LogEmail(Forms!frmEmail!AddressBox, strSubject, strMsgTxt)
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > End With
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > DoCmd.Echo True
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > DoCmd.Hourglass False
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > MsgBox "Email sent to Outlook.", vbInformation, "Notification"
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Exit Function
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > My_Err:
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > DoCmd.Echo True
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > DoCmd.Hourglass False
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > MsgBox Err.Number & " ... " & Err.Description
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Err = 0
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > End Function
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > This is late binding.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > Attachments are previously selected and the path(s) are stored in tblFilenames. The attachments are placed into a folder called OfficeAngelKF.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > It works fine.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > I also have a function that sends emails without using Outlook.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > HTH
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > JB
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > I was thinking of displaying the email to the end user. The Email would open up and the OP would either press Send or close the window and cancel.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > I have a .Display True and by setting to true the Email is presented as modal. Thanks Norman. If the OP presses Send in Outlook, the window closes and finishes the code and does not send the message. If I close the window and cancel the email, no error routine is run. It too will not send the message which is correct. However, if I pressed Send, I must then open up Outlook in order for the email to be sent.
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > This is odd to me. In the past, if I pressed Send, the email would be sent. If I closed the email and canceled it, the error routine would fire. No error routine ever fires. No emails get sent...unless I keep Outlook open. I never had this issue with A2010. A2013 is a new game with differences.
>
> >
>
> >
>
> >
>
> > I forgot to mention. I have my Outlook (Office 2013 version)set so that it does not send emails as soon as they arrive in the outbox. I have to do a send and receive (in Outlook) to send them but I believe that they would automatically go if I changed my Outlook settings.
>
> >
>
> >
>
> >
>
> > JB
>
>
>
> I would not know how to change the Outlook settings. I go to File/Options/Advanced, scroll down a tad, and I have a checkbox set to Send Immediately When Connected checked. Do you know of any other settings to check?
Hi.
Yes.
File, Options, Advanced - but uncheck the 'Send immediately when connected' tick box. Click on the Send/Receive button (over on the right) and you will see some options to schedule auto send/receive every 30 minutes (the default) which you can alter for whatever interval you want.
That's how I stop Outlook from sending my test emails. I don't want to spray emails around the country just because I'm testing stuff and too idle to alter all the email addresses!
JB
[toc] | [prev] | [next] | [standalone]
| From | Neil <xxx@gmail.com> |
|---|---|
| Date | 2014-10-03 01:05 -0500 |
| Message-ID | <542E3CA2.6040005@gmail.com> |
| In reply to | #9957 |
On 10/2/2014 12:59 PM, Patrick Finucane wrote: > I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this > If DisplayEmail Then > .Display > Else > .Save > .Send > End If > > After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message. > > How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly. > Patrick, Where are you looking for the message? If Outlook isn't opened (and only the Outlook Message is displayed), then how would you know whether you've received it or not? Are you using another e-mail reader to look for the message? Looking for it online? Also, when happens if DisplayEmail is False? Does the code send the e-mail OK? Or is it not sent with that option either? For me, whenever I automate Outlook, I create an application object and then the message object, rather than just creating a new message directly. I find that that works better, but YMMV. Also, if the user already has Outlook open, I can just get that instance and use it, instead of opening a new instance. Neil
[toc] | [prev] | [next] | [standalone]
| From | Patrick Finucane <patrickfinucanetx@gmail.com> |
|---|---|
| Date | 2014-10-03 06:13 -0700 |
| Message-ID | <1ffaf00f-b56b-4358-a22b-782fe8821eae@googlegroups.com> |
| In reply to | #9962 |
On Friday, October 3, 2014 2:05:22 AM UTC-4, Neil wrote:
> On 10/2/2014 12:59 PM, Patrick Finucane wrote:
>
> > I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this
>
> > If DisplayEmail Then
>
> > .Display
>
> > Else
>
> > .Save
>
> > .Send
>
> > End If
>
> >
>
> > After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message.
>
> >
>
> > How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly.
>
> >
>
>
>
> Patrick,
>
>
>
> Where are you looking for the message? If Outlook isn't opened (and only
>
> the Outlook Message is displayed), then how would you know whether
>
> you've received it or not? Are you using another e-mail reader to look
>
> for the message? Looking for it online?
>
>
>
> Also, when happens if DisplayEmail is False? Does the code send the
>
> e-mail OK? Or is it not sent with that option either?
>
>
>
> For me, whenever I automate Outlook, I create an application object and
>
> then the message object, rather than just creating a new message
>
> directly. I find that that works better, but YMMV. Also, if the user
>
> already has Outlook open, I can just get that instance and use it,
>
> instead of opening a new instance.
>
>
>
> Neil
I set DisplayEmail to False so instead of .Display if did a .Save and .Send and it worked like a champ as expected. If I .Display and press Send, Outlook must be open. It might be because .Display is not Modal and the code following it runs and closes Outlook There is no trapping of errors if I hit cancel instead of send.
Here's my code
Dim objOutlook As Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim objOutlookRecip As Outlook.Recipient
Dim objOutlookAttach As Outlook.Attachment
On Error GoTo errorHandler
' Create the Outlook session.
Set objOutlook = CreateObject("Outlook.Application")
' Create the message.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
With objOutlookMsg
' Add the To recipient(s) to the message.
Set objOutlookRecip = .Recipients.Add(varAddress)
objOutlookRecip.Type = olTo
.Subject = varSubject
.body = varBody
' Add attachments to the message.
If Not IsMissing(AttachmentPath) And AttachmentPath <> "" Then
Set objOutlookAttach = .Attachments.Add(AttachmentPath)
End If
' Resolve each Recipient's name.
For Each objOutlookRecip In .Recipients
objOutlookRecip.Resolve
Next
' Should we display the message before sending?
If DisplayMsg Then
.Display 'opens email and continues running. Not modal.
Else
.Save
.Send
End If
End With
Set objOutlook = Nothing
ExitTheSub:
Exit Sub
errorHandler:
MsgBox "Error occured at Email_Via_Outlook " & Err.NUMBER & ";" & Err.DESCRIPTION
Resume ExitTheSub
End Sub
[toc] | [prev] | [next] | [standalone]
| From | Neil <xxx@gmail.com> |
|---|---|
| Date | 2014-10-03 14:31 -0500 |
| Message-ID | <m0mti2$33c$1@dont-email.me> |
| In reply to | #9967 |
On 10/3/2014 8:13 AM, Patrick Finucane wrote:
> On Friday, October 3, 2014 2:05:22 AM UTC-4, Neil wrote:
>> On 10/2/2014 12:59 PM, Patrick Finucane wrote:
>>
>>> I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this
>>
>>> If DisplayEmail Then
>>
>>> .Display
>>
>>> Else
>>
>>> .Save
>>
>>> .Send
>>
>>> End If
>>
>>>
>>
>>> After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message.
>>
>>>
>>
>>> How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly.
>>
>>>
>>
>>
>>
>> Patrick,
>>
>>
>>
>> Where are you looking for the message? If Outlook isn't opened (and only
>>
>> the Outlook Message is displayed), then how would you know whether
>>
>> you've received it or not? Are you using another e-mail reader to look
>>
>> for the message? Looking for it online?
>>
>>
>>
>> Also, when happens if DisplayEmail is False? Does the code send the
>>
>> e-mail OK? Or is it not sent with that option either?
>>
>>
>>
>> For me, whenever I automate Outlook, I create an application object and
>>
>> then the message object, rather than just creating a new message
>>
>> directly. I find that that works better, but YMMV. Also, if the user
>>
>> already has Outlook open, I can just get that instance and use it,
>>
>> instead of opening a new instance.
>>
>>
>>
>> Neil
>
> I set DisplayEmail to False so instead of .Display if did a .Save and .Send and it worked like a champ as expected. If I .Display and press Send, Outlook must be open. It might be because .Display is not Modal and the code following it runs and closes Outlook There is no trapping of errors if I hit cancel instead of send.
>
> Here's my code
> Dim objOutlook As Outlook.Application
> Dim objOutlookMsg As Outlook.MailItem
> Dim objOutlookRecip As Outlook.Recipient
> Dim objOutlookAttach As Outlook.Attachment
> On Error GoTo errorHandler
> ' Create the Outlook session.
> Set objOutlook = CreateObject("Outlook.Application")
> ' Create the message.
> Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
> With objOutlookMsg
> ' Add the To recipient(s) to the message.
> Set objOutlookRecip = .Recipients.Add(varAddress)
> objOutlookRecip.Type = olTo
> .Subject = varSubject
> .body = varBody
>
> ' Add attachments to the message.
> If Not IsMissing(AttachmentPath) And AttachmentPath <> "" Then
> Set objOutlookAttach = .Attachments.Add(AttachmentPath)
> End If
>
> ' Resolve each Recipient's name.
> For Each objOutlookRecip In .Recipients
> objOutlookRecip.Resolve
> Next
> ' Should we display the message before sending?
> If DisplayMsg Then
> .Display 'opens email and continues running. Not modal.
> Else
> .Save
> .Send
> End If
> End With
> Set objOutlook = Nothing
> ExitTheSub:
> Exit Sub
> errorHandler:
> MsgBox "Error occured at Email_Via_Outlook " & Err.NUMBER & ";" & Err.DESCRIPTION
> Resume ExitTheSub
> End Sub
>
Have you tried putting a breakpoint on the set objOutlook = Nothing line
to see what happens?
[toc] | [prev] | [next] | [standalone]
| From | Patrick Finucane <patrickfinucanetx@gmail.com> |
|---|---|
| Date | 2014-10-06 06:14 -0700 |
| Message-ID | <3c298925-2276-4dc0-ac10-7d7dc42c0491@googlegroups.com> |
| In reply to | #9971 |
On Friday, October 3, 2014 3:31:04 PM UTC-4, Neil wrote:
> On 10/3/2014 8:13 AM, Patrick Finucane wrote:
>
> > On Friday, October 3, 2014 2:05:22 AM UTC-4, Neil wrote:
>
> >> On 10/2/2014 12:59 PM, Patrick Finucane wrote:
>
> >>
>
> >>> I'm getting something goofy when I automate an email from Access 2013. Outlook is not open at this point. I press a command button on the form to send an email. The code assigns the email elements (Subject, attachment, To, etc) correctly and displays the email prior to sending. All is good at this point. I then press the SEND buttonin Outlook and the email closes. My code looks like this
>
> >>
>
> >>> If DisplayEmail Then
>
> >>
>
> >>> .Display
>
> >>
>
> >>> Else
>
> >>
>
> >>> .Save
>
> >>
>
> >>> .Send
>
> >>
>
> >>> End If
>
> >>
>
> >>>
>
> >>
>
> >>> After pressing the Send button in Outlook, the Outlook email message is closed. I am sending the message to myself for testing. I will wait forever and no message appears in my inbox. The message will ONLY appear when I open up Outlook. It seems doing so releases the message.
>
> >>
>
> >>>
>
> >>
>
> >>> How can I send an email when Outlook is closed initially? I assume I don't have a property setting set correctly.
>
> >>
>
> >>>
>
> >>
>
> >>
>
> >>
>
> >> Patrick,
>
> >>
>
> >>
>
> >>
>
> >> Where are you looking for the message? If Outlook isn't opened (and only
>
> >>
>
> >> the Outlook Message is displayed), then how would you know whether
>
> >>
>
> >> you've received it or not? Are you using another e-mail reader to look
>
> >>
>
> >> for the message? Looking for it online?
>
> >>
>
> >>
>
> >>
>
> >> Also, when happens if DisplayEmail is False? Does the code send the
>
> >>
>
> >> e-mail OK? Or is it not sent with that option either?
>
> >>
>
> >>
>
> >>
>
> >> For me, whenever I automate Outlook, I create an application object and
>
> >>
>
> >> then the message object, rather than just creating a new message
>
> >>
>
> >> directly. I find that that works better, but YMMV. Also, if the user
>
> >>
>
> >> already has Outlook open, I can just get that instance and use it,
>
> >>
>
> >> instead of opening a new instance.
>
> >>
>
> >>
>
> >>
>
> >> Neil
>
> >
>
> > I set DisplayEmail to False so instead of .Display if did a .Save and .Send and it worked like a champ as expected. If I .Display and press Send, Outlook must be open. It might be because .Display is not Modal and the code following it runs and closes Outlook There is no trapping of errors if I hit cancel instead of send.
>
> >
>
> > Here's my code
>
> > Dim objOutlook As Outlook.Application
>
> > Dim objOutlookMsg As Outlook.MailItem
>
> > Dim objOutlookRecip As Outlook.Recipient
>
> > Dim objOutlookAttach As Outlook.Attachment
>
> > On Error GoTo errorHandler
>
> > ' Create the Outlook session.
>
> > Set objOutlook = CreateObject("Outlook.Application")
>
> > ' Create the message.
>
> > Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
>
> > With objOutlookMsg
>
> > ' Add the To recipient(s) to the message.
>
> > Set objOutlookRecip = .Recipients.Add(varAddress)
>
> > objOutlookRecip.Type = olTo
>
> > .Subject = varSubject
>
> > .body = varBody
>
> >
>
> > ' Add attachments to the message.
>
> > If Not IsMissing(AttachmentPath) And AttachmentPath <> "" Then
>
> > Set objOutlookAttach = .Attachments.Add(AttachmentPath)
>
> > End If
>
> >
>
> > ' Resolve each Recipient's name.
>
> > For Each objOutlookRecip In .Recipients
>
> > objOutlookRecip.Resolve
>
> > Next
>
> > ' Should we display the message before sending?
>
> > If DisplayMsg Then
>
> > .Display 'opens email and continues running. Not modal.
>
> > Else
>
> > .Save
>
> > .Send
>
> > End If
>
> > End With
>
> > Set objOutlook = Nothing
>
> > ExitTheSub:
>
> > Exit Sub
>
> > errorHandler:
>
> > MsgBox "Error occured at Email_Via_Outlook " & Err.NUMBER & ";" & Err.DESCRIPTION
>
> > Resume ExitTheSub
>
> > End Sub
>
> >
>
>
>
> Have you tried putting a breakpoint on the set objOutlook = Nothing line
>
> to see what happens?
I put a breakpoint after the .Display and the code, I thought, should pause as the Outlook window would be Modal but it continues on its merry way. I did not know one needed to have Outlook open at all times in order for it to automate an email. I was hoping I simply needed to set an Outlook property to make it work correctly but my hopes are dashed.
[toc] | [prev] | [next] | [standalone]
| From | fmsinc <fmsinc@gmail.com> |
|---|---|
| Date | 2014-10-10 15:44 -0500 |
| Message-ID | <_MWdnQVRipSG2KXJnZ2dnUU7-LOdnZ2d@giganews.com> |
| In reply to | #9957 |
Check out our Total Access Emailer product. It's a Microsoft Access add-in that simplifies the sending of emails and can be done with or without VBA code. There's a free demo. http://www.fmsinc.com/MicrosoftAccess/Email.asp
[toc] | [prev] | [standalone]
Back to top | Article view | comp.databases.ms-access
csiph-web