• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Highlight rows if mail not sent in Excel VBA

coolkiran

Member
Hi All

I have written code which will send mails. Unfortunately for some rows mail address will not be in correct format, for those email, outlook will throw some error like "Outlook doesn't recognize one or more names" and macro will stops running.

Is there any way to highlight that rows and continue macro for next rows.

Here is the code i have used

Code:
For Each olMail In Fldr.Items
Set objmail = olApp.CreateItem(olMailItem)
objmail.To = "MAIL ADDRESS"
With objmail
.Subject = "SUBJECT"
.htmlBody = "Hello" & " " & "<br><br>" & "MESSAGE"
.Display
End With
Exit For
Next
 
Hi Vletm

Code worked, is there a way to highlight row where mail not been sent.

I have attached my file. where i can see mail sent for first row, instead of tracking one by one, can we highlight?
 

Attachments

  • Chandoo.xlsm
    15.5 KB · Views: 3
Back
Top