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
| 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 = Form!INTERLOCUTEURS.Form!Genre & " "
nom2 = nom2 & Forms!Sous - formulaire.Form!prénom & " " & UCase(Forms!SAISI!INTERLOCUTEURS.Form!Nom)
Adresse2 = UCase(Forms!SAISI!Societe) & Chr(10) & nom2 & Chr(10) & Forms!SAISI!Adresse1
Adresse2 = Adresse2 & Chr(10) & Forms!SAISI!Adresse2 & Chr(10)
Adresse2 = Adresse2 & Forms!SAISI!CP & " " & UCase(Forms!SAISI!Ville)
Dim oapp As Object
Set oapp = CreateObject("word.application")
oapp.Visible = True
With oapp
.Documents.Add template:="U:\Mes_documents\MODELES\Lettre2.dot"
With .selection
.Goto , , , "objet"
.insertafter rep2
.Goto , , , "adresse"
.inseertafter Adresse2
.Goto , , , "genre"
.insertafter Forms!SAISI!SAISI.Form!Genre
.Goto , , , "genre2"
.insertafter Forms!SAISI!SAISI.Form!Genre
If rep <> 6 Then
.Goto , , , "ar"
.cut
End If
.Goto , , , "debut"
End With
End With
End Sub |
Partager