![]() |
|
#1
|
||||
|
||||
|
hello all, i am trying to send a bulk mailing out through outlook, and i am getting stuck after a certain period of time of sending. here is my code for the loop: Code:
Function sendall()
'Creates a new e-mail item and modifies its properties
Dim oNS As Object
Dim oContacts As Object
Dim oContactItem As ContactItem
Dim objMail As MailItem
Set oNS = Application.GetNamespace("MAPI")
Set oContacts = oNS.Folders(1).Folders("Contacts")
For Each oContactItem In oContacts.Items
If oContactItem.CompanyName = "temp" Then
Set objMail = Application.CreateItem(olMailItem)
With objMail
'Set body format to HTML
.To = oContactItem.Email1Address
.Subject = "TEST MESSAGE FROM " & oContactItem.FullName
.BodyFormat = olFormatHTML
.HTMLBody = "<HTML><BODY>THIS IS A TEST MESSAGE FROM " & _
oContactItem.FullName & "</BODY></HTML>"
'.Display
.Send
End With
End If
Next
Set oContactItem = Nothing
Set oContacts = Nothing
Set oNS = Nothing
Set objMail = Nothing
End Function
Code:
'PauseTime = 5
'Start = Timer
'Do While Timer < Start + PauseTime
'DoEvents
'Loop
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help setting up mailing labels | auburn84 | Word | 0 | 03-12-2009 04:30 PM |
Documents Take 5 Minutes To Open
|
Farrar | Word | 1 | 07-23-2007 02:54 PM |