Hi,
I made a small macro on Excel which aims to look for a mail on outlook with a specific subject and a specific received time. Works pretty with almost everyone but bugs with the oulook inbox one of my colleague.
The code i wrote:
I tried with 3 outlook accounts and there was no pb but with the 4th account it bugs..
The pb it returns is it highlights "Next oLMail" and says oLMail = Nothing
I would like for my macro to go on and continues and its search and i have some trouble to handle this nothing error.
i was looking for smtg similar to "if mail = nothing then i = i+1 .. next i " but i found on google a "continue for" but my excel doesn't recognize the continue function ? so i don't know what to do
Any advice?
Thanks a lot
I made a small macro on Excel which aims to look for a mail on outlook with a specific subject and a specific received time. Works pretty with almost everyone but bugs with the oulook inbox one of my colleague.
The code i wrote:
Code:
For Each olMail In oDefaultFolder.Items
If olMail.Subject = "DDJ of " & date_target Then
MyAr = Split(olMail.Body, vbCrLf)
For i = LBound(MyAr) To UBound(MyAr)
Sheets("DDJ").Cells(i + 1, 1).Value = MyAr(i)
Next i
ddj_empty = False
Exit For
End If
Next olMail
I tried with 3 outlook accounts and there was no pb but with the 4th account it bugs..
The pb it returns is it highlights "Next oLMail" and says oLMail = Nothing
I would like for my macro to go on and continues and its search and i have some trouble to handle this nothing error.
i was looking for smtg similar to "if mail = nothing then i = i+1 .. next i " but i found on google a "continue for" but my excel doesn't recognize the continue function ? so i don't know what to do
Any advice?
Thanks a lot