J'ai deux procédures, dans la seconde procédure, à la fin je veux faire une boucle vers la première procédure mais à partir d'une certaine ligne (le début de la procédure ne doit pas être executé).
j'ai écrit ce code
Private Sub CommandButton_Supprimer_Click()
If ListBox_Points_Homologues.ListIndex = -1 Then
ListBox_Points_Homologues.RemoveItem (ListBox_Points_Homologues.ListCount - 1)
Else
ListBox_Points_Homologues.RemoveItem (ListBox_Points_Homologues.ListIndex)
End If
ListBox_Points_Homologues.ListIndex = -1
If ListBox_Points_Homologues.ListCount = 0 Then
CommandButton_Supprimer.Enabled = False
Else
CommandButton_Supprimer.Enabled = True
End If
CommandButton_Ouvrir_Click
End Sub
Mais là la procédure commandbutton_ouvrir_click commence au début. Est ce possible de commencer à une ligne définie qui se situe plus loin dans la procédure?
Mais vu le nom de ta fonction, il s'agit de l'événement click d'un bouton, donc voici ce que je te propose :
Public Sub SubEnCommun()
' mets ici le code à exécuter par un appel de procédure extérieur, par exemple :
ListBox_Points_Homologues.ListIndex = -1
If ListBox_Points_Homologues.ListCount = 0 Then
CommandButton_Supprimer.Enabled = False
Else
CommandButton_Supprimer.Enabled = True
End If
End Sub
Public Sub CommandButton_Ouvrir_Click()
' traitement spécifique, par exemple :
If ListBox_Points_Homologues.ListIndex = -1 Then
ListBox_Points_Homologues.RemoveItem (ListBox_Points_Homologues.ListCount - 1)
Else
ListBox_Points_Homologues.RemoveItem (ListBox_Points_Homologues.ListIndex)
End If
Call SubEnCommun() ' appel des traîtements en commun
End Sub
Et du coup, au lieu d'appeler CommandButton_Ouvrir_Click, appelle la sub SubEnCommun.
______________________________________
AVANT de poster votre message, veuillez lire, comprendre, et appliquer notre réglement