1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| Private Sub cmdword_Click()
Dim wdapp As Word.Application
Dim strCheminDoc As String, strCheminFusion As String
Dim strSQL As String
strCheminDoc = "C:\Users\rsidoun\Desktop\log aster\contrataster.doc "
strCheminFusion = "C:\Users\rsidoun\Desktop\log aster\contrat aster auto 4.doc"
strSQL = "SELECT * FROM [offre] WHERE [N° offre 1]= & [N° offre 1]"
Set wdapp = New Word.Application
With wdapp
.Visible = True
.Documents.Open strCheminDoc
With .ActiveDocument.MailMerge
.OpenDataSource Name:=CurrentProject.FullName, _
SQLStatement:=strSQL, _
ReadOnly:=False
.Destination = wdSendToNewDocument
.Execute
End With
.ActiveDocument.SaveAs FileName:=strCheminFusion
End With
strCheminDoc = " C:\Users\rsidoun\Desktop\log aster\contrat aster.doc "
strCheminFusion = "C:\Users\rsidoun\Desktop\log aster\contrat aster auto 4.doc"
strSQL = "SELECT * FROM [offre] WHERE [N° offre 1]= & [N° offre 1]"
Set wdapp = New Word.Application
With wdapp
.Visible = True
.Documents.Open strCheminDoc
With .ActiveDocument.MailMerge
.OpenDataSource Name:=CurrentProject.FullName, _
SQLStatement:=strSQL, _
ReadOnly:=False
.Destination = wdSendToNewDocument
.Execute
End With
.ActiveDocument.SaveAs FileName:=strCheminFusion
End With
Set wdapp = Nothing
End Sub |
Partager