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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
| Private Sub Document_New()
Load UserForm1
UserForm1.Show
End Sub
Private Sub CommandButtonAnnuler_Click()
Me.Hide
End Sub
Private Sub CommandButtonValider_Click()
Dim Societe As String
Dim Titre1 As String
Dim Nom As String
Dim Prenom As String
Dim Adresse As String
Dim Npa As String
Dim Localite As String
Societe = Me.TextBoxSociete.Text
Titre1 = Me.ComboBoxTitre.Value
Nom = Me.TextBoxNom.Value
Prenom = Me.TextBoxPrenom.Value
Adresse = Me.TextBoxAdresse.Value
Boite = Me.TextBoxNPA.Value
Localite = Me.TextBoxLocalite.Value
If Me.ComboBoxTitre.Value = "" Then
MsgBox "Veuillez indiquer le titre", vbExclamation, "Erreur"
Exit Sub
End If
If Me.TextBoxNom.Value = "" Then
MsgBox "Veuillez indiquer le nom", vbExclamation, "Erreur"
Exit Sub
End If
If Me.TextBoxNPA.Value = "" Then
MsgBox "Veuillez indiquer le numéreau postal", vbExclamation, "Erreur"
Exit Sub
End If
If Me.TextBoxLocalite.Value = "" Then
MsgBox "Veuillez indiquer la localité", vbExclamation, "Erreur"
Exit Sub
End If
RemplirSignet Titre1, "Titre1"
RemplirSignet Societe, "Societe"
RemplirSignet Nom, "Nom"
RemplirSignet Prenom, "Prenom"
RemplirSignet Adresse, "Adresse"
RemplirSignet Npa, "NPA"
RemplirSignet Localite, "Localite"
ActiveDocument.Fields.Update
Me.Hide
End Sub
Private Sub UserForm_Initialize()
With Me.ComboBoxTitre
.AddItem "Monsieur"
.AddItem "Madame"
.AddItem "Madame, Monsieur"
End With
End Sub
Public Sub RemplirSignet(texte As String, Signet As String)
ActiveDocument.Bookmarks(Signet).Range.Text = texte
End Sub |
Partager