Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 12-16-2011, 07:42 AM
DoctorNadir DoctorNadir is offline Error 5631 in Mail Merge Windows XP Error 5631 in Mail Merge Office 2007
Novice
Error 5631 in Mail Merge
 
Join Date: Dec 2011
Posts: 4
DoctorNadir is on a distinguished road
Default

Hi macropod,
thank you for assisting me
I had already read that kb, but it should not apply to my case, because the excel table (the oDataDoc in the MS example) is closed.
The
Have time to take a look at my code? (the point rows are code of no importance)
Code:
Private Sub cmdRegistraVerbale_Click()
......................................
Workbooks.Open Filename:=archivio
......................................
numero = ActiveCell.Value
......................................
Workbooks(archivio).Save                     ' i know it's useless (could use 'true' in next)
Workbooks(archivio).Close (False)          ' but who knows...
......................................
On Error Resume Next
        
       Set wd = GetObject(, "Word.Application")
       If wd Is Nothing Then
          Set wd = CreateObject("Word.Application")
       End If
    
       On Error GoTo 0

       Set wdocSource = wd.Documents.Open(modverbale)
    
       wdocSource.MailMerge.MainDocumentType = wdFormLetters

       With wdocSource.MailMerge
          .Destination = wdSendToNewDocument
          .SuppressBlankLines = True
          With .DataSource
               .FirstRecord = numero
               .LastRecord = numero
          End With
          .Execute Pause:=False                 ' error 5631 here
       End With

       wdocSource.MailMerge.DataSource.Close
    
       wd.Visible = True

       With wd.Documents(wd.ActiveDocument.FullName)
           .SaveAs ("newfile.doc")
           .PrintOut
           .Close
       End With

       wdocSource.Close SaveChanges:=False
    
       wd.NormalTemplate.Saved = True
'archivio' is an .xls file (1 sheet)
'modverbale' the .doc file in which the links to the table are embedded
'numero' the record number (the last one) to be merged.

the 'archivio' seems to be saved correctly, the last record is there.
I tried to change the name to both files, creating from scratch the new .doc and thus rebuilding the SQL link: at first, it seems to work (the MailMerge wizard sees all the records), but the sub stops at the very same place
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error 5631 in Mail Merge Mail Merge error message rec Mail Merge 1 04-29-2011 10:30 PM
Mail merge error? SRE Outlook 0 01-11-2010 05:54 PM
Error: general mail failure. Quit excel restart mail system MitchellDM Outlook 1 12-19-2008 02:05 AM
Error Message in Mail Merge A Bhavani Mail Merge 0 11-26-2008 12:08 PM
Error 5631 in Mail Merge Mail Merge Calculation Error Lsbutler2000 Mail Merge 1 06-22-2007 06:33 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:34 PM.


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