View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dave Baxandall Dave Baxandall is offline
external usenet poster
 
Posts: 1
Default VBA mailmerge from Excel

I have a problem starting Mailmerge from Excel. I've
created a macro in word that runs the mailmerge without
any problems. When I start word from Excel (which is also
the data source) I get a pop-up telling me that the excel
file is already open. I then need to choose read-only,
notify or cancel. This pop-up can take up to 60 seconds to
display. In the mean time the excel macro returns a error
message - 440 Method 'Run' of object '_Application' failed.

In debug the word code that takes a long time is.

Sub z_create_mail_merge(source As String)
'
' z_create_mail_merge Macro
' Macro recorded 2003/10/14 by TELUS
'
' Connection:="merge_it" is the range on the spreadsheet

ActiveDocument.MailMerge.MainDocumentType =
wdFormLetters
ActiveDocument.MailMerge.OpenDataSource Name:= _
source, _
ConfirmConversions:=False, ReadOnly:=True,
LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="",
PasswordTemplate:="", _
WritePasswordDocument:="",
WritePasswordTemplate:="", Revert:=True, _
Format:=wdOpenFormatAuto, Connection:="merge_it",
SQLStatement:="", _
SQLStatement1:=""
....

Thanks in advance
Dave Baxandall