Can't catch a break today - email from Excel troubles
Thanks JP.
You were correct in your initial review that the original code does actually
work. I tried this at work to send to co-workers and it failed, but I had
also used it to send to my home address and it worked.
I was wondering if you had any thoughts on why it might fail at work. Im
sure they have additional securities in place that it has to deal with, but
you think it would at least bounce back to me or something else if that was
the issue.
Any thoughts on what I could check to see if thats the case with my
workplace IT?
Thanks - Jenny B.
It worked for me. May I make some suggestions for your code? I wasn't
sure what "aFrom" was so I commented it out (for purposes of
debugging).
Sub SalesandLisaEmail()
Dim olApp As Outlook.Application
Dim Msg As Outlook.MailItem
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")
If Err.Number < 0 Then
Set olApp = CreateObject("Outlook.Application")
End If
On Error GoTo 0
If olApp Is Nothing Then
MsgBox "Cannot start Outlook.", vbExclamation
GoTo ExitProc
End If
Set Msg = olApp.CreateItem(olMailItem)
With Msg
.Subject = "New Issue" & " - " & ActiveSheet.Range("h5").Value
.Body = "There is a new B55 Checklist for review." & vbNewLine & _
vbNewLine & "After you've had a chance to review and sign off on
the Checklist," & _
"please forward to the DMS Group for final review." & vbNewLine &
vbNewLine & _
"Thank you - DMS Group."
With .Recipients
.Add ")
.ResolveAll
End With
' Const olOriginator = 0
' If Len(aFrom) 0 Then .Recipients.Add(aFrom).Type = olOriginator
.Send
End With
ExitProc:
Set Msg = Nothing
Set olApp = Nothing
End Sub
On Jan 15, 4:25 pm, Jenny B. wrote:
I just tried to add other recipients other than my test self to the email and
it still send to me.
Even after I totally removed my email and inserted another person - it sent
the email solely to me. Any thoughts?
Sub SalesandLisaEmail()
Dim Outlook
Set Outlook = CreateObject("Outlook.Application")
Dim Message
Set Message = Outlook.CreateItem(olMailItem)
With Message
.Subject = "New Issue" & " - " & ActiveSheet.Range("h5").Value
.body = "There is a new B55 Checklist for review." & vbNewLine &
vbNewLine & "After you've had a chance to review and sign off on the
Checklist, please forward to the DMS Group for final review." & vbNewLine &
vbNewLine & "Thank you - DMS Group."
Application.DisplayAlerts = False
.Recipients.Add ")
Const olOriginator = 0
If Len(aFrom) 0 Then .Recipients.Add(aFrom).Type = olOriginator
.Send
End With
Call Clear
End Sub
|