Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Mailmerge and Fax / March 2004

Tip: Looking for answers? Try searching our database.

Data merge into text boxes?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Nicole - 22 Mar 2004 21:12 GMT
Help! Only one thing is standing between me and data merge Nirvana:
the ability to merge directly into formatted text boxes. I've got text
boxes overlaid on a background graphic in a non-linear layout (former
graphic designer ;), and I need to merge my data into them. Problem
is, when I do so, all of my records merge to a single page (my form
letter document is a single page), so I've got dozens of overlapping
text boxes--a gigantic mess! Is there any fix for this?

I'm on a Mac running OS X 10.2.8 and Office X for Mac.

Thanks!
Nicole Freed
Peter Jamieson - 24 Mar 2004 11:40 GMT
I suspect you will need to create a VBA macro that does one merge for each
record in your data source. I assume that is possible on the Mac. For
example

Sub ProduceOneDocPerSourceRec()
'

' NB, needs bettor error management and doubtless other things a VBA expert
' will point out.

Dim intSourceRecord
Dim objMerge As Word.MailMerge
Dim strOutputDocumentName As String
Dim TerminateMerge As Boolean

' Need to set up this object as the ActiveDocument changes when the
' merge is performed. Besides, it's clearer.

Set objMerge = ActiveDocument.MailMerge
With objMerge

' If no data source has been defined, do it here using OpenDataSource.
' But if it is already defined in the document, you should not need to
define it here.

'  .OpenDataSource _
'    Name:="whatever"

 intSourceRecord = 1
 TerminateMerge = False

 Do Until TerminateMerge
   .DataSource.ActiveRecord = intSourceRecord

   ' if we have gone past the end (and possibly, if there are no records)
   ' then the Activerecord will not be what we have just tried to set it to

   If .DataSource.ActiveRecord <> intSourceRecord Then
     TerminateMerge = True
   ' the record exists
   Else

    ' while we are looking at the correct activerecord,
     ' create the document path name
     ' e.g. - you will definitely need to change this for the Mac
     strOutputDocumentName = "c:\mydoc\" &
.DataSource.Datafields("Journal_Name").Value &
" Stylesheet.doc"

     .DataSource.FirstRecord = intSourceRecord
     .DataSource.LastRecord = intSourceRecord
     .Destination = wdSendToNewDocument
     .Execute

     ' The Activedocument is always the output document
     ' Add any parameters you need to these calls
     ActiveDocument.SaveAs strOutputDocumentName
     ActiveDocument.Close
     intSourceRecord = intSourceRecord + 1
   End If
 Loop
End With
End Sub

Signature

Peter Jamieson - Word MVP
Word MVP web site http://word.mvps.org/

> Help! Only one thing is standing between me and data merge Nirvana:
> the ability to merge directly into formatted text boxes. I've got text
[quoted text clipped - 8 lines]
> Thanks!
> Nicole Freed
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.