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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
|
Private Sub Button_Intro_Click()
Application.ScreenUpdating = False
'Coloration des Labels en noir / non gras
LAuteur1.ForeColor = RGB(0, 0, 0)
LAuteur1.Font.Bold = False
LAuteur2.ForeColor = RGB(0, 0, 0)
LAuteur2.Font.Bold = False
LLieu.ForeColor = RGB(0, 0, 0)
LLieu.Font.Bold = False
LQualite1.ForeColor = RGB(0, 0, 0)
LQualite1.Font.Bold = False
LQualite2.ForeColor = RGB(0, 0, 0)
LQualite2.Font.Bold = False
LObjet.ForeColor = RGB(0, 0, 0)
LObjet.Font.Bold = False
LRef.ForeColor = RGB(0, 0, 0)
LRef.Font.Bold = False
F_Annexes.ForeColor = RGB(0, 0, 0)
F_Annexes.Font.Bold = False
F_Copies.ForeColor = RGB(0, 0, 0)
F_Copies.Font.Bold = False
'Contrôles de contenu
If TB_Auteur2.Value <> "" Then 'contrôle de l'indication d'un 2e auteur et de sa qualité
LQualite2.ForeColor = RGB(255, 0, 0)
LQualite2.Font.Bold = True
MsgBox "S'il y a un 2e auteur, alors sa qualité doit être mentionnée"
ElseIf TB_Auteur1.Value = "" Then 'Nom et prénom de l'auteur 1 --> Si vide, alors
LAuteur1.ForeColor = RGB(255, 0, 0) 'label en rouge
LAuteur1.Font.Bold = True 'et gras
LRem.ForeColor = RGB(255, 0, 0) 'Colore aussi la remarque en bas en rouge
LRem.Font.Bold = True ' et gras
ElseIf TB_Qualite1.Value = "" Then 'Qualité de l'auteur 1
LQualite1.ForeColor = RGB(255, 0, 0)
LQualite1.Font.Bold = True
LRem.ForeColor = RGB(255, 0, 0)
LRem.Font.Bold = True
ElseIf TB_Lieu.Value = "" Then 'Lieu
LLieu.ForeColor = RGB(255, 0, 0)
LLieu.Font.Bold = True
LRem.ForeColor = RGB(255, 0, 0)
LRem.Font.Bold = True
ElseIf TB_Objet.Value = "" Then 'Objet
LObjet.ForeColor = RGB(255, 0, 0)
LObjet.Font.Bold = True
LRem.ForeColor = RGB(255, 0, 0)
LRem.Font.Bold = True
ElseIf TB_Ref.Value = "" Then 'No de référence
LRef.ForeColor = RGB(255, 0, 0)
LRef.Font.Bold = True
LRem.ForeColor = RGB(255, 0, 0)
LRem.Font.Bold = True
ElseIf OB_Annexes_oui.Value Or OB_Annexes_non.Value = 0 Then 'Choix Annexes
F_Annexes.ForeColor = RGB(255, 0, 0)
F_Annexes.Font.Bold = True
LRem.ForeColor = RGB(255, 0, 0)
LRem.Font.Bold = True
ElseIf OB_Annexes_oui.Value = 1 And TB_Annexes.Value = "" Then
MsgBox "S'il y a une ou des annexes, prière de la/les mentionner"
ElseIf OB_Copies_oui.Value Or OB_Copies_non.Value = 0 Then 'Choix Copies
F_Copies.ForeColor = RGB(255, 0, 0)
F_Copies.Font.Bold = True
LRem.ForeColor = RGB(255, 0, 0)
LRem.Font.Bold = True
ElseIf OB_Copies_oui.Value = 1 And TB_Copies.Value = "" Then
MsgBox "S'il y a une ou des copies à adresser, prière d'indiquer les destinataires"
Else
With ActiveDocument
.Bookmarks("Lieu").Range.Text = UserForm1.TB_Lieu.Value
.Bookmarks("Date").Range.Text = UserForm1.DTPicker1.Value
.Bookmarks("Objet").Range.Text = UserForm1.TB_Objet.Value
.Bookmarks("ref_AFS").Range.Text = UserForm1.TB_Ref.Value
.Bookmarks("Auteur1").Range.Text = UserForm1.TB_Auteur1.Value
.Bookmarks("Auteur2").Range.Text = UserForm1.TB_Auteur2.Value
.Bookmarks("Qualite1").Range.Text = UserForm1.TB_Qualite1.Value
.Bookmarks("Qualite2").Range.Text = UserForm1.TB_Qualite2.Value
.Bookmarks("Annexes").Range.Text = UserForm1.TB_Annexes.Value
.Bookmarks("copies_a").Range.Text = UserForm1.TB_Copies.Value
End With
End If
Application.ScreenUpdating = True
With Application.FileDialog(msoFileDialogSaveAs)
.Title = "Sauvegarde du document AFS créé"
.InitialFileName = Format(Date) & " - " & TB_Objet.Value & ".docx"
.Show
.Execute
End With
Unload Me 'ferme le masque
End Sub |
Partager