VB Code in Word

pagrender

Well-known Member
Joined
Sep 3, 2008
Messages
652
Hello,

I am trying to create a print macro from a Word document that has been created through mail merge.

All I need it to do is 1) Quick Print 2) Go to the next record 3) Quick Print 4) Go to the next record..... When it reaches the last record I need it to stop.

Can someone help write this macro for me? The Macro Recorder has given me the following, but I do not know how to put the "loop" into the code.

Sub Macro1()
'
' Macro1 Macro
'
'
ActiveDocument.PrintOut
ActiveDocument.MailMerge.DataSource.ActiveRecord = wdNextRecord


End Sub

Thanks!
Pete
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
In case you are wondering why doesn't the user (that's me) just complete the merge, creating a large document that lists all the documents and he can print from there?

There were other circumstances involved, such as I needed two stapled copies of each four-page record. Creating all records into one large document doesn't allow me the option to staple every four pages when it will be printing out. I found out it was easier to change my default print settings to print to my requirements. Every time I hit Quick Print on the Quick Access Toolbar, Word prints two double-sided, stapled copies of each record.

I just would like a macro so I don't have to hit the Next button and Quick Print button hundreds of times. Hope that makes sense.
 
Upvote 0
So why not merge twice - once to the printer and once to a new document? Provided your mailmerge main document and printer are properly configured, the merge to printer should take care of the stapling. The alternative would be to use a macro to either merge each record to the printer as a separate job or to send each Section from the merged output to the printer as a separate job. The approach you envisage with your macro won't work on the merged output because that's just a standard document and has no records, as such, within it.
 
Upvote 0

Forum statistics

Threads
1,225,730
Messages
6,186,698
Members
453,369
Latest member
positivemind

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top