![]() |
#4
|
||||
|
||||
![]()
Being offline doesn't affect how quickly the emails will be sent - only when they'll be sent. Adding a delay loop to the RunMerge macro cannot affect that (i.e. they'll all go out together as soon as you go online or use Send/Receive for the relevant folder).
That said, if you're already online you could try replacing the existing RunMerge macro (only) with Code:
Sub RunMerge() Application.ScreenUpdating = False Dim Doc1 As Document, Doc2 As Document, Doc3 As Document, StrDoc As String, i As Long, j As Long Set Doc1 = ThisDocument StrDoc = ThisDocument.Path & "\EmailDataSource.doc" If Dir(StrDoc) <> "" Then Kill StrDoc With Doc1.MailMerge If .State = wdMainAndDataSource Then .Destination = wdSendToNewDocument .Execute Set Doc2 = ActiveDocument End If End With Call EmailMergeTableMaker(Doc2) With Doc2 j = .Tables(1).Rows.Count - 1 .SaveAs FileName:=StrDoc, AddToRecentFiles:=False, FileFormat:=wdFormatDocument StrDoc = .FullName .Close End With Set Doc2 = Nothing Set Doc3 = Documents.Open(FileName:=Doc1.Path & "\Email Merge Main Document.doc", _ AddToRecentFiles:=False) With Doc3.MailMerge .MainDocumentType = wdEMail .OpenDataSource Name:=StrDoc, ConfirmConversions:=False, ReadOnly:=False, _ LinkToSource:=True, AddToRecentFiles:=False, Connection:="", SQLStatement:="", _ SQLStatement1:="", SubType:=wdMergeSubTypeOther If .State = wdMainAndDataSource Then '.Destination = wdSendToNewDocument .Destination = wdSendToEmail .MailAddressFieldName = "Recipient" .MailSubject = "Monthly Sales Stats" '.MailFormat = wdMailFormatHTML .MailFormat = wdMailFormatPlainText For i = 1 To j With .DataSource .FirstRecord = i .LastRecord = i .ActiveRecord = i End With .Execute Pause:=False Call Pause(10) Next i End If End With Doc3.Close SaveChanges:=False Set Doc3 = Nothing Application.ScreenUpdating = True End Sub Public Function Pause(Delay As Long) Dim Start As Long Start = Timer If Start + Delay > 86399 Then Start = 0: Delay = (Start + Delay) Mod 86400 Do While Timer > 1 DoEvents ' Yield to other processes. Loop End If Do While Timer < Start + Delay DoEvents ' Yield to other processes. Loop End Function Call Pause(10) Presently, it's set for 10 seconds. At that rate, 300 emails would take 50 minutes to send...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
nevin27 | Mail Merge | 29 | 02-17-2023 09:26 AM |
![]() |
User02182016 | Mail Merge | 1 | 02-23-2016 06:02 PM |
Delay After Hours Messages Automatically | kskalwat | Outlook | 0 | 03-18-2015 02:59 PM |
Catalogue e-mail merge problem | lol22 | Mail Merge | 4 | 02-15-2013 02:59 AM |
Email send delay--where? | markg2 | Outlook | 8 | 02-14-2010 03:40 PM |