Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-11-2014, 01:42 AM
jopegk jopegk is offline How to staple mail merged documents Windows 7 64bit How to staple mail merged documents Office 2010 64bit
Novice
How to staple mail merged documents
 
Join Date: Jun 2014
Posts: 6
jopegk is on a distinguished road
Default How to staple mail merged documents

Hi,



I wonder if it is possible to print my mail merged document as stapled copies.

My document consists of 18 pages and has the merge field as a copy number on every page. While the document is big I want it auto-stapled in the printer (my printer has that function) but I can't find a way to make that happen and still keep the unique copy number on every copy.

Thanks!
Reply With Quote
  #2  
Old 06-11-2014, 05:41 PM
macropod's Avatar
macropod macropod is offline How to staple mail merged documents Windows 7 32bit How to staple mail merged documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

To do that, you would need to send each merged document to the printer as a separate print job. For that, you could use a macro such as:
Code:
Sub Merge_To_Individual_Print_Jobs()
'Merges one record at a time to the printer
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument
  For i = 1 To .MailMerge.DataSource.RecordCount
    With .MailMerge
      .Destination = wdSendToPrinter
      .SuppressBlankLines = True
      With .DataSource
        .FirstRecord = i
        .LastRecord = i
        .ActiveRecord = i
      End With
      .Execute Pause:=False
    End With
  Next i
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 06-12-2014, 12:16 AM
jopegk jopegk is offline How to staple mail merged documents Windows 7 64bit How to staple mail merged documents Office 2010 64bit
Novice
How to staple mail merged documents
 
Join Date: Jun 2014
Posts: 6
jopegk is on a distinguished road
Default

Thanks, macropod!

It seems to work, but I get a message from Visual Basic that says that something is wrong ("Runtime error '5853': Invalid parameter."). Is that a problem?
Reply With Quote
  #4  
Old 06-12-2014, 01:02 AM
macropod's Avatar
macropod macropod is offline How to staple mail merged documents Windows 7 32bit How to staple mail merged documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I suspect the error message is occurring because you're using an Excel data source and it has 'used' rows below the last data row. You could probably prevent the error by inserting:
If Trim(.DataFields("FieldName")) = "" Then Exit For
after:
.ActiveRecord = i
where 'FieldName' is the name of any field in the data source that should never be empty.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #5  
Old 06-12-2014, 01:38 AM
jopegk jopegk is offline How to staple mail merged documents Windows 7 64bit How to staple mail merged documents Office 2010 64bit
Novice
How to staple mail merged documents
 
Join Date: Jun 2014
Posts: 6
jopegk is on a distinguished road
Default

So I need to insert the field name of my database where it says "FieldName" in your code?

What are the fields called? a1?
Reply With Quote
  #6  
Old 06-12-2014, 01:41 AM
macropod's Avatar
macropod macropod is offline How to staple mail merged documents Windows 7 32bit How to staple mail merged documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The header row should have the field names - they also appear in your mailmerge main document, listed in the 'Insert Mergefield' dropdown.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #7  
Old 06-12-2014, 01:49 AM
jopegk jopegk is offline How to staple mail merged documents Windows 7 64bit How to staple mail merged documents Office 2010 64bit
Novice
How to staple mail merged documents
 
Join Date: Jun 2014
Posts: 6
jopegk is on a distinguished road
Default

Now I did that, but the message still appears.

Should the code say "Form" instead of "For"?
Reply With Quote
  #8  
Old 06-12-2014, 02:12 AM
macropod's Avatar
macropod macropod is offline How to staple mail merged documents Windows 7 32bit How to staple mail merged documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

No, it should say 'Exit For', as posted.

When you get the error message, does the popup display a 'debug' button? if so, what code line is highlighted? Also, if you hover the mouse over the 'i' in '.ActiveRecord = i', note the number then check the corresponding row in the data source (which should be one more than the 'i' value). Check whether that row has data and whether there is anything materially different about the data on that row from the other rows.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #9  
Old 06-12-2014, 02:36 AM
jopegk jopegk is offline How to staple mail merged documents Windows 7 64bit How to staple mail merged documents Office 2010 64bit
Novice
How to staple mail merged documents
 
Join Date: Jun 2014
Posts: 6
jopegk is on a distinguished road
Default

Yes, there's a debug-button and the row ".ActiveRecord = i" is highlighted. When I hover the mouse over it, it says ".ActiveRecord = i = False".
Reply With Quote
  #10  
Old 06-12-2014, 04:36 AM
macropod's Avatar
macropod macropod is offline How to staple mail merged documents Windows 7 32bit How to staple mail merged documents Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

"i = False" seems odd. The other thing you could try is inserting:
On Error Resume Next
before:
With .MailMerge
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #11  
Old 06-12-2014, 05:21 AM
jopegk jopegk is offline How to staple mail merged documents Windows 7 64bit How to staple mail merged documents Office 2010 64bit
Novice
How to staple mail merged documents
 
Join Date: Jun 2014
Posts: 6
jopegk is on a distinguished road
Default

No message!
Thanks a lot!
Reply With Quote
  #12  
Old 01-13-2023, 08:55 AM
Sloan149 Sloan149 is offline How to staple mail merged documents Windows 10 How to staple mail merged documents Office 2021
Novice
 
Join Date: Jan 2023
Posts: 3
Sloan149 is on a distinguished road
Default

Is there a way to ask what page range in this document you want to print out. I have a similar issue with a larger document that needs to be mail merge printed and stapled out, but there are times that I need to narrow down the range of pages.

Thanks!
Reply With Quote
  #13  
Old 01-14-2023, 04:38 AM
macropod's Avatar
macropod macropod is offline How to staple mail merged documents Windows 10 How to staple mail merged documents Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Preferably, you'd use the mailmerge filters to output only the records you actually want to print. Otherwise, you can send the output to a new Word document, then tell your printer which Sections of the output document to print, by inserting the section references into the print dialogue (e.g. s2-s5,s7,s9-s11).
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #14  
Old 01-14-2023, 08:27 PM
Sloan149 Sloan149 is offline How to staple mail merged documents Windows 10 How to staple mail merged documents Office 2021
Novice
 
Join Date: Jan 2023
Posts: 3
Sloan149 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Preferably, you'd use the mailmerge filters to output only the records you actually want to print. Otherwise, you can send the output to a new Word document, then tell your printer which Sections of the output document to print, by inserting the section references into the print dialogue (e.g. s2-s5,s7,s9-s11).
Thanks, but I was more referring to the macro code referenced above. For that code, it doesn’t bring out the print dialogue, and it does not ask what page ranges I want to print. Is there another couple line of codes that I can insert for it to ask me what range of pages I want to print?
Reply With Quote
  #15  
Old 01-15-2023, 05:05 AM
macropod's Avatar
macropod macropod is offline How to staple mail merged documents Windows 10 How to staple mail merged documents Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

As I said:
Quote:
Preferably, you'd use the mailmerge filters to output only the records you actually want to print.
If you want to be able to select only specific pages, you would have to send the output to a new Word document, then choose the pages from there.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to staple mail merged documents Align Mail Merged Numbers to the Decimal Point HangMan Mail Merge 1 12-11-2013 02:32 PM
Insert Text between Mail Merged Items kawirider88 Mail Merge 1 09-29-2013 06:55 PM
saving a mail merged document after the user edits it. kosh2 Mail Merge 0 08-05-2011 03:35 AM
How to staple mail merged documents Overlapping text once mail merged Spartan300 Mail Merge 6 10-13-2010 06:14 PM
How to staple mail merged documents No toggle b/w 2 accounts; mail merged in 1 inbox Windwardman Outlook 1 06-09-2010 09:25 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:58 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft