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
|
Const CSTR_RESULTAT_TEST = "résultat test"
Const CSTR_RESULTAT_EXECUTION = "résultat exécution"
Const CSTR_PAS_AFFICHAGE = "pas d'affichage"
Const CINT_POSITION_IMAGE_RESULTAT_TEST = 6 ' 6 correspond à la colonne F
Const CINT_POSITION_IMAGE_RESULTAT_EXECUTION = 12 12 correspond à la coonne L
Const CINT_POSITION_IMAGE_RESULTAT_NE_PAS_AFFICHER = -99
' ici on définit les valeurs d'une liste
Const PAS_D_AFFICHAGE = "Pas d'affichage"
Const AFFICHAGE_IMAGE_EXECUTION = "Affichage image exécution"
Const AFFICHAGE_IMAGE_DU_TEST = "Affichage image du test"
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim cellule As Range
Dim Position_image As Integer
Dim Pint_colonne_courante As Integer
Dim Pstr_nom_image As String
Dim A As Range
Dim B As Range
Mafenetre.Lbl_pb_image.Visible = False
Set cellule = Worksheets("Test fonctionnel").Cells(3, 4)
If (cellule = AFFICHAGE_IMAGE_DU_TEST) Then
Position_image = CINT_POSITION_IMAGE_RESULTAT_TEST
ElseIf (cellule = AFFICHAGE_IMAGE_EXECUTION) Then
Position_image = CINT_POSITION_IMAGE_RESULTAT_EXECUTION
Else
Position_image = CINT_POSITION_IMAGE_RESULTAT_NE_PAS_AFFICHER
End If
If Position_image = CINT_POSITION_IMAGE_RESULTAT_TEST Or Position_image = CINT_POSITION_IMAGE_RESULTAT_EXECUTION Then
Pint_colonne_courante = ActiveCell.Column
Pstr_nom_image = ActiveCell.Offset(0, Position_image - Pint_colonne_courante).Value
If Pstr_nom_image <> "" Then
If UCase$(Right$(Pstr_nom_image, 4)) = ".JPG" Then
If Dir(Pstr_nom_image) <> "" Then
Mafenetre.Picture = LoadPicture(Pstr_nom_image)
Mafenetre.Show False
Else
Mafenetre.Picture = LoadPicture("")
Mafenetre.Lbl_pb_image.Caption = "Image Non Trouvée ???"
Mafenetre.Lbl_pb_image.Visible = True
End If
Else
Mafenetre.Picture = LoadPicture("")
End If
Else
Mafenetre.Picture = LoadPicture("")
End If
End If
End Sub |
Partager