Re: trouble in sending email
Hi all,
Why won’t Outlook sent from the code below? It opens to MS Outlook window and after clicking “yes” to send email. Sometimes it hangs. But when trying to open Outlook to check the email, it won’t open Outlook program and in Windows Task Manager you can see Outlook in Process. If you delet it the email is not sent.
But the strange thing is if I put a break in the code say “End With” and ran the subroutine it disappear in Windows Task Manager and the email is sent in Outlook.
Sub
Dim objOL As New Outlook.Application
Dim objMail As MailItem
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = "alicew@applerubber.com"
.Subject = "Test Message"
.Body = vbCrLf & vbCrLf & "Work Order Line # " & vbCrLf & 123456 & " " & "001" & ""
.Send
End With
Set objOL = Nothing
Set objMail = Nothing
End Sub
Thanks for your input!
Hi all,
Why won’t Outlook sent from the code below? It opens to MS Outlook window and after clicking “yes” to send email. Sometimes it hangs. But when trying to open Outlook to check the email, it won’t open Outlook program and in Windows Task Manager you can see Outlook in Process. If you delet it the email is not sent.
But the strange thing is if I put a break in the code say “End With” and ran the subroutine it disappear in Windows Task Manager and the email is sent in Outlook.
Sub
Dim objOL As New Outlook.Application
Dim objMail As MailItem
Set objOL = New Outlook.Application
Set objMail = objOL.CreateItem(olMailItem)
With objMail
.To = "alicew@applerubber.com"
.Subject = "Test Message"
.Body = vbCrLf & vbCrLf & "Work Order Line # " & vbCrLf & 123456 & " " & "001" & ""
.Send
End With
Set objOL = Nothing
Set objMail = Nothing
End Sub
Thanks for your input!