Hi guys,
I'm looking for some help with my code.
I would like to select a group of emails and run a script that drafts a new email with the To field populated with only those that have a '@Hotmail.com' email address.
Does this make sense?
Right now, my code is very much a mish mash of attempts. Hope you can help 
Here's what I have so far:
Public Sub CreateNewMessageBasedOnSelection2()
Dim objMsg As MailItem
Dim Selection As Selection
Dim obj As Object
Dim numbers() As Integer, recipientSize As Integer, i As Integer
Set Selection = ActiveExplorer.Selection
For Each obj In Selection
Set objMsg = Application.CreateItem(olMailItem)
recipientSize = Selection.Count()
MsgBox recipientSize & " messages selected"
'Create an array of recipients and send back to -WORKING
For i = 1 To recipientSize
MsgBox ("For Loop " & i & " " & obj.SenderEmailAddress)
Next i
Dim strFriends(0 To 3) As String, lngPosition As Long
strFriends(0) = obj.SenderEmailAddress
strFriends(1) = "Jeana"
strFriends(2) = "Sam"
strFriends(3) = "Jenna"
For lngPosition = LBound(strFriends) To UBound(strFriends)
MsgBox strFriends(lngPosition) & " = lngPosition"
Next lngPosition
With objMsg
.To = strFriends(0) & "; " & strFriends(1) 'Or use obj.SenderEmailAddress"
.Subject = "This is the subject"
.Categories = "Test"
.Body = "---------" & vbCrLf & vbCrLf & obj.Body
.Display
' use .Send to send it automatically
End With
Set objMsg = Nothing
Next
End Sub
Many thanks,
Pepe.
Bookmarks