From: JT on
I'm using the code below to send e-mails to different cost centers. With
this code, the user will get the Outlook security message and they have to
click "ok" to send the message. This is okay because there may be situations
where they will not want to send the message.

The part I'm having trouble with is when they click "no" to not send the
e-mail. I'm looking for suggestions on how to close the e-mail being
displayed and move to the next record.

Thanks for your help....


Do Until eNumb > BrNum

vHTMLString = "<HTML><BODY>" _
& "<font face=Arial>" _
& "<font size=3>" _
& "Branch: " & EMdata1(eNumb) _
& "<br> Date: " & EMdata2(eNumb) _
& "<br> Deposit: " & EMdata3(eNumb) _
& "<br> Days Outstanding: " & EMdata4(eNumb) _
& "<br> Balance: " & EMdata5(eNumb) & "<br>" _
& eMsg

With myitem

For OthNum = 1 To UBound(Addrdata1)
If Addrdata1(OthNum) = EMdata1(eNumb) Then
.To = Addrdata2(OthNum)
Exit For
End If
Next

.Subject = SubjectLine
.HTMLBody = vHTMLString
.Display
.Send

End With

--
JT
From: Barb Reinhardt on
I don't know if this willl help, but I normally save my emails to draft
instead of sending.

I'd change .send to .display

And after the end with, put this

Call CloseItem(OutApp)


Sub CloseItem(OutApp As Object)
Dim myinspector As Object
Dim myItem As Object

Set myinspector = OutApp.ActiveInspector
Set myItem = myinspector.CurrentItem
myItem.Close 0 'olSave
End Sub

I have a feeling that you can change the 0 in the last line of the above
procedure to not save.
--
HTH,

Barb Reinhardt



"JT" wrote:

> I'm using the code below to send e-mails to different cost centers. With
> this code, the user will get the Outlook security message and they have to
> click "ok" to send the message. This is okay because there may be situations
> where they will not want to send the message.
>
> The part I'm having trouble with is when they click "no" to not send the
> e-mail. I'm looking for suggestions on how to close the e-mail being
> displayed and move to the next record.
>
> Thanks for your help....
>
>
> Do Until eNumb > BrNum
>
> vHTMLString = "<HTML><BODY>" _
> & "<font face=Arial>" _
> & "<font size=3>" _
> & "Branch: " & EMdata1(eNumb) _
> & "<br> Date: " & EMdata2(eNumb) _
> & "<br> Deposit: " & EMdata3(eNumb) _
> & "<br> Days Outstanding: " & EMdata4(eNumb) _
> & "<br> Balance: " & EMdata5(eNumb) & "<br>" _
> & eMsg
>
> With myitem
>
> For OthNum = 1 To UBound(Addrdata1)
> If Addrdata1(OthNum) = EMdata1(eNumb) Then
> .To = Addrdata2(OthNum)
> Exit For
> End If
> Next
>
> .Subject = SubjectLine
> .HTMLBody = vHTMLString
> .Display
> .Send
>
> End With
>
> --
> JT