MailMerge Macro HELP

  • Thread starter Dirdata via OfficeKB.com
  • Start date
D

Dirdata via OfficeKB.com

I created the following macro in word.

Sub MailMerge()
'
' MailMerge Macro
' Macro recorded 09/28/06 by DirData
'
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True

x = 1

For Y = 1 To 10970
With .DataSource
.FirstRecord = x
.LastRecord = x + 9
End With
.Execute Pause:=True
Let x = x + 10
Next Y
End With
End Sub


the above macro will do a mail merge 10 records at a time, and send them to
my printer. But, what it does, that i don't like is that it has me click the
OK button after each 10th record.

How can i have this macro not ask me to hit the OK button???

Thanks

Gary T
 
C

Cindy M.

Hi Dirdata,
I created the following macro in word.

Sub MailMerge()
'
' MailMerge Macro
' Macro recorded 09/28/06 by DirData
'
With ActiveDocument.MailMerge
.Destination = wdSendToPrinter
.MailAsAttachment = False
.MailAddressFieldName = ""
.MailSubject = ""
.SuppressBlankLines = True

x = 1

For Y = 1 To 10970
With .DataSource
.FirstRecord = x
.LastRecord = x + 9
End With
.Execute Pause:=True
Let x = x + 10
Next Y
End With
End Sub


the above macro will do a mail merge 10 records at a time, and send them to
my printer. But, what it does, that i don't like is that it has me click the
OK button after each 10th record.

How can i have this macro not ask me to hit the OK button???
Some things to try, but no guarantees (except on the last)

1. See if setting Application.DisplayAlerts = wdAlertsNone helps

2. Put a SendKeys in (you'll have to test for the best place in the code - Send
Keys is tricky) to dismiss the message: SendKeys "{Enter}"

3. Perform the merge to a new document, then use the macro on that to print 10
pages at a time.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top