R
Ronster
Hi everyone
I would like to know how can I handle if a user have sent the email
when using the Display (vbModal) option.
I am using the modal option because I need to have the code to stop
and when the event is trigger I am returning a true or false value.
Here is a potion of my code. The portion where I handle if user has
not sent the email work’s fine and I display a message box .
Where I have the problem is when user does sent the email. The line
of code (If Not .Sent Then) get me an error Item has been move or
delete. Is there a way I can handle this problem
Thank you all for your time.
Ron
' Add recipients to MailItem object's Recipients collection.
With objNewMail
.Recipients.Add txtTo
' Let Outlook verify that these are valid recipients.
blnResolved = .Recipients.ResolveAll
' Set MailItem object's Subject and Body properties.
.Subject = txtSubject
.Body = txtMessage
' Set MailItem object's Importance property.
.Importance = olImportanceHigh
If blnResolved = False Then ' invalid recipient
'User has enter an invalid user name
MsgBox "Invalid user name. Make another selection",
vbInformation
Else
.ReadReceiptRequested = True
' Send or Display MailItem depending on user's choice.
If bDisplayMsg Then
.Display (vbModal)
If Not .Sent Then ' user did not send the email
MsgBox ("must send it: " & .To)
bSent = False
Exit Function
End If
Else
.Send
bSent = True
End If
End If
End With
I would like to know how can I handle if a user have sent the email
when using the Display (vbModal) option.
I am using the modal option because I need to have the code to stop
and when the event is trigger I am returning a true or false value.
Here is a potion of my code. The portion where I handle if user has
not sent the email work’s fine and I display a message box .
Where I have the problem is when user does sent the email. The line
of code (If Not .Sent Then) get me an error Item has been move or
delete. Is there a way I can handle this problem
Thank you all for your time.
Ron
' Add recipients to MailItem object's Recipients collection.
With objNewMail
.Recipients.Add txtTo
' Let Outlook verify that these are valid recipients.
blnResolved = .Recipients.ResolveAll
' Set MailItem object's Subject and Body properties.
.Subject = txtSubject
.Body = txtMessage
' Set MailItem object's Importance property.
.Importance = olImportanceHigh
If blnResolved = False Then ' invalid recipient
'User has enter an invalid user name
MsgBox "Invalid user name. Make another selection",
vbInformation
Else
.ReadReceiptRequested = True
' Send or Display MailItem depending on user's choice.
If bDisplayMsg Then
.Display (vbModal)
If Not .Sent Then ' user did not send the email
MsgBox ("must send it: " & .To)
bSent = False
Exit Function
End If
Else
.Send
bSent = True
End If
End If
End With