Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-02-2011, 08:24 AM
SaneMan SaneMan is offline Automatically split Mail Merge based on number of pages Windows 98/ME Automatically split Mail Merge based on number of pages Office 2003
Novice
Automatically split Mail Merge based on number of pages
 
Join Date: Jan 2011
Posts: 20
SaneMan is on a distinguished road
Default Automatically split Mail Merge based on number of pages

Hello



I'm working on a project and wondered if one of you could help with a query I have.

I'm issuing a number of licences (10,000 in total) via a mail merge. Each licence will have 7 pages. I'm trying to figure out how, after I complete the mail merge, I can run a macro to split the document into individual licences and save the licences with a filename based on the licence number (I assume assigning this licence number field a particular style would be the way to do this).

I've attached a mock up example to this post which shows the correct amount of pages and the licence number field (this will be two letters followed by some numbers and two more letters, i.e. 'AB1234CD').

Does anybody know of a Macro which can carry out this task? I've found a variety of them but none of them seem to satisfy the specific one I need. Any help would be greatly appreciated.

Many thanks.
Attached Files
File Type: doc Example_MM.doc (147.0 KB, 8 views)
Reply With Quote
  #2  
Old 12-03-2011, 01:11 AM
macropod's Avatar
macropod macropod is offline Automatically split Mail Merge based on number of pages Windows 7 64bit Automatically split Mail Merge based on number of pages 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

Hi Saneman,

Presumably the licence # is in the same position for every licence. In that case, it's simply a matter of using a Range statement (eg StrName = .Range(1050,1060)). With the document you posted, for example, you can retrieve the licence # with:
Msgbox Activedocument.Range(104, 113)

To find where the licence #s appear in each Section, select the first one and use:
Code:
Sub test()
Dim StrName As String, i As Long, j As Long
With ActiveDocument
  i = .Range(Selection.Start).Start
  j = .Range(Selection.End).Start
  StrName = .Range(i, j)
  MsgBox "Start" & vbTab & "end" & vbTab & "String" & vbCr & i & vbTab & j & vbTab & StrName
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic charts based on mail merge fields jwajehee Mail Merge 0 10-05-2011 09:47 AM
Automatically split Mail Merge based on number of pages Mail Merge, Number to 2 Decimal Places Vampy99 Mail Merge 7 09-25-2011 05:41 AM
Automatically split Mail Merge based on number of pages Inserting pages at the end of a mail merge morten_lysgaard Mail Merge 3 07-25-2011 11:19 PM
Automatically split Mail Merge based on number of pages Mail merge number fields outputting inconsistently rekcots Mail Merge 2 05-18-2011 06:32 AM
delete blank pages from mail merge document blusea Word 0 12-17-2010 06:10 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:56 AM.


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