Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
[email protected] lucas.bowser@gmail.com is offline
external usenet poster
 
Posts: 1
Default Mailmerge.execute failing...

I have an application that is doing a mailmerge via OLE automation.
Seems to be very standard. The general process is

1) create the data file.
2) open the document for mail merge.
3) attach data source
4) merge it

However, it will fail every time when I have a data source file that
appears to be too big (at least that is my guess at this time), and the
data file is really not all that big. The document that is being
merged has one field

{ INCLUDETEXT "{MERGEFIELD 1}" }

Which is used to select what document will be inserted into the mail
merge. (Each data file may contain multiple document templates that
must be used).

If I have 50 records in the data file, the process will fail every
time. If I have 25, it will never fail. Other information that may be
relevant.

1) I am working with Word 2003
2) There is an image in the documents that is being inserted (it is a
static image, not linked)
3) Also when the failure occurs, it does not return an error to the
OLE automation server. I do not know that the failure/crash has
occured until I go to unlink the fields, and it fails with an RPC
error.

Any help at all would be appreciated.

TIA,

Lucas J. Bowser

  #2   Report Post  
Posted to microsoft.public.word.mailmerge.fields
Peter Jamieson Peter Jamieson is offline
external usenet poster
 
Posts: 4,582
Default Mailmerge.execute failing...

I haven't tested this, and can only make some guesses/rather obvious
suggestions, but
a. using INCLUDETEXT for this kind of thing appears to have got more and
more unreliable over the years (even though this approach is documented in
an MS KB article)
b. does the merge work if you do it manually with the 50 records?
c. Does it make any difference what the data source is?
d. Are you able to remove the images from the included documents - if so,
does that make a difference (it wasn't clear whether or not you had actually
tried that).
c. does it take a long time to merge?

Assuming the problem is either "it takes a long time" or "the output is
large", all you can do is try to reduce the time/size or look for another
approach. other than removing inherently large objects such as images, I
only know of one real show-stopper in merge, and that's using formatted
bullets in your source documents.

One possible workaround is to merge a single record at a time, i.e. do 50
merges of 1 record each. However, the code I have for that would only work
for a "letter" type merge which was going directly to a printer or to
separate output files, not a "directory" or "catalog" type merge. Here's the
(VBA) code, just in case:

Sub ProduceOneDocPerSourceRec()
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

' if you are merging to output documents, you
' need to create the document names...
' while we are looking at the correct activerecord,
' create the document path name
' e.g. something like the following, but in this case
' each lastname must be unique (and must not contain
' characters that are not allowed in a file name)
strOutputDocumentName = _
"c:\mymergeletters\_" & _
..DataSource.Datafields("lastname").Value & _
" letter.doc"
..DataSource.FirstRecord = intSourceRecord
..DataSource.LastRecord = intSourceRecord
' Comment in/out the destination you need
..Destination = wdSendToNewDocument
'.Destination = wdSendToPrinter
'please check the constant name
..Execute

' Deal with the output document, if any
' 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

Peter Jamieson

wrote in message
oups.com...
I have an application that is doing a mailmerge via OLE automation.
Seems to be very standard. The general process is

1) create the data file.
2) open the document for mail merge.
3) attach data source
4) merge it

However, it will fail every time when I have a data source file that
appears to be too big (at least that is my guess at this time), and the
data file is really not all that big. The document that is being
merged has one field

{ INCLUDETEXT "{MERGEFIELD 1}" }

Which is used to select what document will be inserted into the mail
merge. (Each data file may contain multiple document templates that
must be used).

If I have 50 records in the data file, the process will fail every
time. If I have 25, it will never fail. Other information that may be
relevant.

1) I am working with Word 2003
2) There is an image in the documents that is being inserted (it is a
static image, not linked)
3) Also when the failure occurs, it does not return an error to the
OLE automation server. I do not know that the failure/crash has
occured until I go to unlink the fields, and it fails with an RPC
error.

Any help at all would be appreciated.

TIA,

Lucas J. Bowser



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional use of merge fields suddenly failing [email protected] Mailmerge 4 May 17th 06 09:02 AM
How do I fix Word 2003 failing to start EXCEL32.CNV? exit17 Microsoft Word Help 5 November 29th 05 07:32 AM
Word failing to save document changes Bunrabbit Microsoft Word Help 0 September 28th 05 09:30 PM
My Word 2003 cut and paste function keeps failing bill Microsoft Word Help 0 April 26th 05 02:48 AM
Hyperlinks to network file locations failing. Electronic Lady New Users 0 January 6th 05 03:19 AM


All times are GMT +1. The time now is 03:43 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"