![]() |
#5
|
|||
|
|||
![]()
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 '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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
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 |
![]() |
Lsbutler2000 | Mail Merge | 1 | 06-22-2007 06:33 AM |