SendMail pause
-
- 5StarLounger
- Posts: 1148
- Joined: 08 Feb 2010, 21:27
SendMail pause
I have used the subroutine SendMail before and was wondering if it can be made to pause prior to sending so the user can modify it first.
-
- 3StarLounger
- Posts: 287
- Joined: 09 Mar 2010, 23:16
- Location: Canberra Australia
Re: SendMail pause
Does this use SendObject? If so the last parameter in a SendObject command is "EditMessage" and takes either true or false.
Regards
John
John
-
- 5StarLounger
- Posts: 1148
- Joined: 08 Feb 2010, 21:27
Re: SendMail pause
No it doesn't use SendObject, it uses Outlook automation.
-
- 3StarLounger
- Posts: 287
- Joined: 09 Mar 2010, 23:16
- Location: Canberra Australia
-
- 5StarLounger
- Posts: 1148
- Joined: 08 Feb 2010, 21:27
Re: SendMail pause
Thanks John, I'll try that.
Just tried it, and the Outlook security message pops up, i click on allow to send,it momentarily shows the email then it disappears. There is no instance of the email and its not in the Outbox or Sent folder.
Any ideas?
Maybe the following at the end of the function closes it before i can get to send it manually?
Just tried it, and the Outlook security message pops up, i click on allow to send,it momentarily shows the email then it disappears. There is no instance of the email and its not in the Outbox or Sent folder.
Any ideas?
Maybe the following at the end of the function closes it before i can get to send it manually?
Code: Select all
' Release object memory
On Error Resume Next
If Not (objMI Is Nothing) Then objMI.close olDiscard
Set objMI = Nothing
If blnNotActive And Not (objOL Is Nothing) Then objOL.Quit
Set objOL = Nothing
SysCmd acSysCmdClearStatus
DoCmd.Hourglass False
Exit Function
-
- 3StarLounger
- Posts: 287
- Joined: 09 Mar 2010, 23:16
- Location: Canberra Australia
Re: SendMail pause
I am not familiar with the code you are using...but in the version I use there are two instances of .Send (or .Display) at different points.
I have had problems in the past when I change one but not the other.
What version of Office are you using?
Added later:
I did not notice the code when I posted this message. I think your explanation looks correct. I would see what happens without those lines.
I have had problems in the past when I change one but not the other.
What version of Office are you using?
Added later:
I did not notice the code when I posted this message. I think your explanation looks correct. I would see what happens without those lines.
Last edited by JohnH on 21 Oct 2010, 04:45, edited 1 time in total.
Regards
John
John
-
- 5StarLounger
- Posts: 1148
- Joined: 08 Feb 2010, 21:27
Re: SendMail pause
2003.
That code above releases Outlook from memory and so the user doesn't get a chance to change anything. If i omit that code it works fine, although it would leave those object variables in memory.
How would I test if the Email has been sent, I presume that if i know that i can then execute that code.
That code above releases Outlook from memory and so the user doesn't get a chance to change anything. If i omit that code it works fine, although it would leave those object variables in memory.
How would I test if the Email has been sent, I presume that if i know that i can then execute that code.
-
- 3StarLounger
- Posts: 287
- Joined: 09 Mar 2010, 23:16
- Location: Canberra Australia
Re: SendMail pause
What happens if you just remove this line?
If Not (objMI Is Nothing) Then objMI.close olDiscard
if you set blnNotActive to false then this line would do nothing,
If blnNotActive And Not (objOL Is Nothing) Then objOL.Quit
If Not (objMI Is Nothing) Then objMI.close olDiscard
if you set blnNotActive to false then this line would do nothing,
If blnNotActive And Not (objOL Is Nothing) Then objOL.Quit
Regards
John
John
-
- 3StarLounger
- Posts: 287
- Joined: 09 Mar 2010, 23:16
- Location: Canberra Australia
Re: SendMail pause
You could add another Parameter to the sendmail function that controls whether you Send it or Display it.
Then modify the code you have displayed to take account of the value of that parameter.
Then modify the code you have displayed to take account of the value of that parameter.
Regards
John
John
-
- 5StarLounger
- Posts: 1148
- Joined: 08 Feb 2010, 21:27
Re: SendMail pause
I understand but don't need to as the client always wants to have the ability to change the email before it goes out.
-
- Administrator
- Posts: 78519
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: SendMail pause
As the author of the original version of the code (I posted it in Woody's Lounge years ago), I agree with John: remove (or comment out) the lines
If Not (objMI Is Nothing) Then objMI.close olDiscard
and
If blnNotActive And Not (objOL Is Nothing) Then objOL.Quit
to prevent the e-mail from disappearing immediately after it is displayed.
If Not (objMI Is Nothing) Then objMI.close olDiscard
and
If blnNotActive And Not (objOL Is Nothing) Then objOL.Quit
to prevent the e-mail from disappearing immediately after it is displayed.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 1148
- Joined: 08 Feb 2010, 21:27
Re: SendMail pause
I know you are the author of the code, thank you for allowing me to use it, it has been extremely helpful.
I did as you and John have suggested and it works just fine.
Again thank you Hans and John.
I did as you and John have suggested and it works just fine.
Again thank you Hans and John.