csilabgirl
Active Member
- Joined
- Aug 14, 2009
- Messages
- 359
Excel 2002
I use this code below and it works fine. Problem is, sometimes cell A8 does not have an email adress in it, but the user will still click the send button because they do not realize there is no email in the "to:" and it will send because there is an email address in the Bcc. I wanted an IF/THEN code that would check if the "to:" was blank and then give a message box telling them of the error. I added the following code If .Item.To = "" then msgbox ("Error"). But it did not work, if gives me the error msgbox regardless of it is blank or if it has an email address in it. Thanks for the help everyone.
ActiveSheet.Range("A1:G39").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Item.To = ClearContents
.Item.To = Range("A8")
.Item.Subject = Range("A9")
.Item.Bcc = "SampleReceipt@chromosomal-labs.com"
End With
I use this code below and it works fine. Problem is, sometimes cell A8 does not have an email adress in it, but the user will still click the send button because they do not realize there is no email in the "to:" and it will send because there is an email address in the Bcc. I wanted an IF/THEN code that would check if the "to:" was blank and then give a message box telling them of the error. I added the following code If .Item.To = "" then msgbox ("Error"). But it did not work, if gives me the error msgbox regardless of it is blank or if it has an email address in it. Thanks for the help everyone.
ActiveSheet.Range("A1:G39").Select
ActiveWorkbook.EnvelopeVisible = True
With ActiveSheet.MailEnvelope
.Item.To = ClearContents
.Item.To = Range("A8")
.Item.Subject = Range("A9")
.Item.Bcc = "SampleReceipt@chromosomal-labs.com"
End With