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
| Option Compare Database
Private Sub Envoi_Lettre_Click()
Dim nom2
rep2 = InputBox("Veuillez saisir un objet pour votre lettre")
rep = MsgBox("S'agit'il d'une lettre recommandée ?", vbYesNo + vbInformation)
nom2 = Forms!SAISI!INTERLOCUTEURS.Form!Genre & " "
nom2 = nom2 & Forms!SAISI!INTERLOCUTEURS.Form!Prenom & " " & UCase(Forms!SAISI!INTERLOCUTEURS.Form!Nom)
Adresse2 = UCase(Form!SAISI!Societe) & Chr(10) & nom2 & Chr(10) & Form!SAISI!Adresse1
Adresse2 = Adresse2 & Chr(10) & Form!SAISI!Adresse2 & Chr(10)
Adresse2 = Adresse2 & Form!SAISI!CP & " " & UCase(Form!SAISI!Ville)
Dim oApp As Object
Set oApp = CreateObject("word.application")
oApp.Visible = True
With oApp
.Documents.Add template:="C:\Documents and Settings\armelle.bechieau\Bureau\Catherine\lettre.dot"
With .selection
.Goto , , , "objet"
.insertafter rep2
.Goto , , , "adresse"
.insertafter Adresse2
.Goto , , , "Genre"
.insertafter Forms!SAISI!INTERLOCUTEURS.Form!Genre
.Goto , , , "genre2"
.insertafter Forms!SAISI!INTERLOCUTEURS.Form!Genre
If rep <> 6 Then
.Goto , , , "ar"
.cut
End If
.Goto , , , "debut"
End With
End With
End Sub |
Partager