.sent=False

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

After successfuly putting together the code to open an outlook email and
letting the user decide to send the email or not, I would like the code to do
one thing if the user sends the email and another if they decide to canel.

When the user clicks cancel, I have code that says:

If .Sent = False Then
MsgBox "This message will not be sent.", 64, "Test System"
End If

But, if the user sends the email, the code stops. It does not process any
further. And guess what, If .sent=True does not do anything.

Help please.
 
MailItem.Sent is a read-only property. You can't set it in code. Outlook sets it to True after the user (or a code statement) has sent the item.

What procedure is running your code?

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Thanks Sue. I am running an Access.mdb that will loop through several
records and create an email for each record. I would like the email to be
displayed and the user decide if they would like to send the email. If they
do, the procedure will do one thing, if they don't, another.
 
The message object variable will go out of scope of the procedure that creates it when the user sends or closes the item. If you want to handle either of those events, you'll need to instantiate a MailItem object WithEvents and use write event handlers for its Send and Close events.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top