Hi
I need help in VB codes in excel, I am getting error:
Run-time error ‘-2147024894(80070002)
System cannot find the file specified
I have passted my vb code below, what should I do that if I get this error it shoudl still continue with the next cell skipping this error message.
A B
Email id file
1@yahoo.com c:\kdmtemp\206564.zip
2@yahoo.com c:\kdmtemp\206616.zip
3aaa@yahoo.com c:\kdmtemp\208168.zip
4aaa@yahoo.com c:\kdmtemp\206344.zip
Vb codes which I am using:
Sub sendEmail()
Dim i
Dim myOutlook As Object
Dim myMailItem As Object
For i = 1 To 100
If Range("a" & i + 1) <> "" Then
Set otlapp = CreateObject("Outlook.Application")
Set otlNewMail = otlapp.CreateItem(olMailItem)
fName = Range("b" & i + 1)
With otlNewMail
.To = Range("a" & i + 1)
.CC = Range("a" & i + 1)
.Subject = "Email from me"
.Body = "Attached is today's Report."
.Attachments.Add fName
.Display
End With
End If
Next i
Set otlNewMail = Nothing
Set otlapp = Nothing
Set otlAttach = Nothing
Set otlMess = Nothing
Set otlNSpace = Nothing
End Sub
Bookmarks