Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default to many e-mails

From book and net I've put the following together. It sends all right with
only 12 addresses on wks sheet. It sends 200 plus. I sure missed something.
This is first attemp at automation for e-mail. Some place it is repeating and
I am stumped.
Thanks to anyone

Heres what I've got

Sub SendEmail()
Dim x As Integer
Dim MyTimer As Double
'Change this loop as needed.
For x = 1 To 25
'Dummy Loop here just to waste time.
'Replace this loop with your actual code.
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
'Create Outlook object
Set OutlookApp = CreateObject("Outlook.Application")
'Loop through the rows
For Each cell In Columns("K").Cells.specialcells(xlcelltypeconstant s)
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"
'Create Mail Item and send it
Set MItem = OutlookApp.CreateItem(0)
With MItem
.To = EmailAddr
.subject = Subj
.Body = Msg
'.Display
'NOTE: To actually send the emails, use .Send instead of .Display
.Send
End With
End If
Next
MyTimer = Timer
Do
Loop While Timer - MyTimer < 0.03
Application.StatusBar = "Progress: " & x & " of 25: " & Format(x / 25,
"Percent")
DoEvents
Next x
Application.StatusBar = False
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default to many e-mails

Hi Curt

See
http://www.rondebruin.nl/mail/folder3/message.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Curt" wrote in message ...
From book and net I've put the following together. It sends all right with
only 12 addresses on wks sheet. It sends 200 plus. I sure missed something.
This is first attemp at automation for e-mail. Some place it is repeating and
I am stumped.
Thanks to anyone

Heres what I've got

Sub SendEmail()
Dim x As Integer
Dim MyTimer As Double
'Change this loop as needed.
For x = 1 To 25
'Dummy Loop here just to waste time.
'Replace this loop with your actual code.
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
'Create Outlook object
Set OutlookApp = CreateObject("Outlook.Application")
'Loop through the rows
For Each cell In Columns("K").Cells.specialcells(xlcelltypeconstant s)
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"
'Create Mail Item and send it
Set MItem = OutlookApp.CreateItem(0)
With MItem
.To = EmailAddr
.subject = Subj
.Body = Msg
'.Display
'NOTE: To actually send the emails, use .Send instead of .Display
.Send
End With
End If
Next
MyTimer = Timer
Do
Loop While Timer - MyTimer < 0.03
Application.StatusBar = "Progress: " & x & " of 25: " & Format(x / 25,
"Percent")
DoEvents
Next x
Application.StatusBar = False
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 469
Default to many e-mails

Thanks Much

"Ron de Bruin" wrote:

Hi Curt

See
http://www.rondebruin.nl/mail/folder3/message.htm



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Curt" wrote in message ...
From book and net I've put the following together. It sends all right with
only 12 addresses on wks sheet. It sends 200 plus. I sure missed something.
This is first attemp at automation for e-mail. Some place it is repeating and
I am stumped.
Thanks to anyone

Heres what I've got

Sub SendEmail()
Dim x As Integer
Dim MyTimer As Double
'Change this loop as needed.
For x = 1 To 25
'Dummy Loop here just to waste time.
'Replace this loop with your actual code.
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
'Create Outlook object
Set OutlookApp = CreateObject("Outlook.Application")
'Loop through the rows
For Each cell In Columns("K").Cells.specialcells(xlcelltypeconstant s)
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"
'Create Mail Item and send it
Set MItem = OutlookApp.CreateItem(0)
With MItem
.To = EmailAddr
.subject = Subj
.Body = Msg
'.Display
'NOTE: To actually send the emails, use .Send instead of .Display
.Send
End With
End If
Next
MyTimer = Timer
Do
Loop While Timer - MyTimer < 0.03
Application.StatusBar = "Progress: " & x & " of 25: " & Format(x / 25,
"Percent")
DoEvents
Next x
Application.StatusBar = False
End Sub


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Coma between two e-mails Hemang Excel Discussion (Misc queries) 3 May 13th 10 10:30 PM
Finding e-mails James Excel Worksheet Functions 0 February 11th 09 11:15 AM
Opening e-mails HarleyB Excel Discussion (Misc queries) 2 January 23rd 09 06:21 PM
send e-mails bra863 Excel Discussion (Misc queries) 1 August 22nd 08 04:28 PM
e-mails addresses thd3 Excel Worksheet Functions 1 October 8th 07 09:20 PM


All times are GMT +1. The time now is 12:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"