C
Curt
The following code gets the e-mail addresses and send e-mails ok. What I
havent been able to do is stop display. Would like to send as now without
having display then close each one. Would someone see if you can kick me
where I have left something out.
Thanks
'Send E-Mails
Private Sub OptionButton9_Click()
OptionButton9.Value = False
UserForm4_Letters.Hide
Sheets("E-mail test").Select
'Dim objOutlook As Outlook.Application
Dim OutlookApp As Object
Dim MItem As Object
Dim cell As range
Dim Subj As String
Dim EmailAddr As String
Dim Recipient As String
Dim Bonus As String
Dim Msg As String
' Sheets("E-mail test").Select
'Create Outlook object
Set OutlookApp = CreateObject("Outlook.Application")
'Loop through the rows
For Each cell In Columns("K").Cells.specialcells(xlcelltypeconstants)
If cell.Value Like "*@*" Then
'Get the data
Subj = "Veteran's Day Parade"
Recipient = cell.Offset(0, -1).Value
EmailAddr = cell.Value
'Compose message
Msg = "Dear Participant:" & vbCrLf & vbCrLf
Msg = Msg & "I am pleased to inform you that" & vbCrLf & vbCrLf
Msg = Msg & "Your CD of Veteran's Day Parade Is available "
Msg = Msg & Bonus & vbCrLf & vbCrLf
Msg = Msg & "Dan Rupe" & vbCrLf
Msg = Msg & "Chairman"
Msg = Msg & "sent by program" & vbCrLf
'Create Mail Item and send it
Set MItem = OutlookApp.CreateItem(0)
With MItem
.To = EmailAddr
.subject = Subj
.Body = Msg
'.Display
.Send
' .Close
End With
End If
'Set OutlookMsg = Nothing
Set OutlookApp = Nothing
' Set mOutlookApp = Nothing
Next
End Sub
havent been able to do is stop display. Would like to send as now without
having display then close each one. Would someone see if you can kick me
where I have left something out.
Thanks
'Send E-Mails
Private Sub OptionButton9_Click()
OptionButton9.Value = False
UserForm4_Letters.Hide
Sheets("E-mail test").Select
'Dim objOutlook As Outlook.Application
Dim OutlookApp As Object
Dim MItem As Object
Dim cell As range
Dim Subj As String
Dim EmailAddr As String
Dim Recipient As String
Dim Bonus As String
Dim Msg As String
' Sheets("E-mail test").Select
'Create Outlook object
Set OutlookApp = CreateObject("Outlook.Application")
'Loop through the rows
For Each cell In Columns("K").Cells.specialcells(xlcelltypeconstants)
If cell.Value Like "*@*" Then
'Get the data
Subj = "Veteran's Day Parade"
Recipient = cell.Offset(0, -1).Value
EmailAddr = cell.Value
'Compose message
Msg = "Dear Participant:" & vbCrLf & vbCrLf
Msg = Msg & "I am pleased to inform you that" & vbCrLf & vbCrLf
Msg = Msg & "Your CD of Veteran's Day Parade Is available "
Msg = Msg & Bonus & vbCrLf & vbCrLf
Msg = Msg & "Dan Rupe" & vbCrLf
Msg = Msg & "Chairman"
Msg = Msg & "sent by program" & vbCrLf
'Create Mail Item and send it
Set MItem = OutlookApp.CreateItem(0)
With MItem
.To = EmailAddr
.subject = Subj
.Body = Msg
'.Display
.Send
' .Close
End With
End If
'Set OutlookMsg = Nothing
Set OutlookApp = Nothing
' Set mOutlookApp = Nothing
Next
End Sub