1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
Dim oDoc As Word.Document
Set objWord = CreateObject("Word.Application")
Set mvarDocumentId = objWord.Documents.Add(Template_File, False)
objWord.ActiveDocument.MailMerge.MainDocumentType = wdFormLetters
objWord.ActiveDocument.MailMerge.Destination = wdSendToNewDocument
objWord.ActiveDocument.MailMerge.MailAsAttachment = False
objWord.ActiveDocument.MailMerge.MailAddressFieldName = ""
objWord.ActiveDocument.MailMerge.MailSubject = ""
objWord.ActiveDocument.MailMerge.SuppressBlankLines = True
If objWord.ActiveDocument.MailMerge.DataSource.FindRecord(FindText:=Numéro, Field:="Numéro") = True Then numRecord = objWord.ActiveDocument.MailMerge.DataSource.ActiveRecord
objWord.ActiveDocument.MailMerge.Execute Pause:=True
On Error Resume Next
MyObj.ActiveDocument.AttachedTemplate.Saved = True
objWord.Application.Visible = True
objWord.Application.WindowState = WD_WindowStateMaximize
objWord.Application.Activate
Set objWord = Nothing |
Partager