I have VBA code that has been working flawlessly for year. Now all of a sudden I am getting an error:
send error code.PNG
Run-Time error '-2147467259 (80004005)':
Outlook does not recognize one or more names.
When I select debug, .send is highlighted. I put the same workbook on another computer and everything runs fine with no errors.
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
With OutMail
.To = ActiveSheet.Range("Q59").Value
.Cc = ActiveSheet.Range("Q60").Value
.Subject = ActiveSheet.Range("Q61").Value
.HTMLBody = ActiveSheet.Range("P62").Value & ",<br><br>" & _
ActiveSheet.Range("P67").Value & _
ActiveSheet.Range("R67").Value & "<br>" & _
"<font color=""#FF0000""><strong><br>" & ActiveSheet.Range("P99").Value & "</font></strong><br><br>" & _
"Regards," & "<br><br>" & "The " & ActiveSheet.Range("P19").Value & " Support Team<br><br>"
.Attachments.Add pdfName
.Attachments.Add ManualForm
.HTMLBody = .HTMLBody & logo & vbCr & vbCr & vbCr & ManEntGoals
.Send
End With
Any Ideas!!!
EDIT: I found a solution that does not make sense, but it works. By simply adding .Display a line before .Send the VBA code does not fail. I was thinking it might be a speed issue where the VBA code is runing too fast. So I added a delay statement just before the .Send. I added: Application.Wait Now + TimeSerial(0, 0, 5) which delays the running of the VBA code by 5 seconds. But it still fails when it reaches .Send. The one thing I find interesting is that I use the .Send command about 3 times to send emails to specific people, but they don't fail.
I don't feel comfortable with the .Display command fixing the issue. Any one know why that works.
Bookmarks