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
| Private Sub GoToWord()
Dim WAPP As New Microsoft.Office.Interop.Word.Application
Dim UnDoc As New Microsoft.Office.Interop.Word.Document
UnDoc = WAPP.Documents.Add(Dossier & "\Vide.2SES")
WAPP.ShowMe()
WAPP.Visible = True
With WAPP
.ActiveDocument.MailMerge.MainDocumentType = Microsoft.Office.Interop.Word.WdMailMergeMainDocType.wdCatalog
.ActiveDocument.MailMerge.OpenDataSource(Name:= _
NomDBComplet, _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True, _
AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", _
WritePasswordDocument:="", WritePasswordTemplate:="", Revert:=False, _
Format:=Microsoft.Office.Interop.Word.WdOpenFormat.wdOpenFormatAuto, Connection:= _
"Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User ID=Admin;Data Source=" & NomDBComplet & ";Mode=Read;Extended Properties="""";Jet OLEDB:System database="""";Jet OLEDB:Registry Path="""";Jet OLEDB:Database Password="""";Jet OLEDB:E" _
, SQLStatement:="SELECT * FROM `TEtudiant`", SQLStatement1:="")
End With
With WAPP
.ActiveDocument.MailMerge.Execute()
End With
WAPP.PrintPreview = True
UnDoc.Close(Nothing)
End Sub |
Partager