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
| Option Explicit
Private Sub ButtonAjoutIncident_Click()
Dim n As Long, i As Long
With Me.TabStrip1
n = .Count - 1
'--- affiche premier des onglets masqués
For i = 0 To n
If .Tabs(i).Visible = False Then
.Tabs(i).Visible = True
.Value = i
TabStrip1_Click i
Exit For
End If
Next i
'--- si nécessaire, ajoute un oonglet
If i > n Then
.Tabs.Add "Tabstrip1", "Incident " & i + 1
.Value = i
End If
End With
End Sub
Private Sub ButtonSupprimeIncident_Click()
'--- masque le dernier onglet visible (aucune suppression d'onglet)
Dim i As Long
For i = Me.TabStrip1.Count To 1 Step -1
If Me.TabStrip1.Tabs(i - 1).Visible Then
Me.TabStrip1.Value = i - 2
TabStrip1_Click i - 2
Me.TabStrip1.Tabs(i - 1).Visible = False
Exit For
End If
Next i
End Sub
Private Sub TabStrip1_Click(ByVal Index As Long)
Debug.Print "TabStrip1.Index: " & Index
If Index = 0 Then
Me.TabStrip2.Tabs(1).Visible = True
ElseIf Index = 1 Then
Me.TabStrip2.Tabs(1).Visible = False
End If
End Sub
Private Sub TabStrip2_Click(ByVal Index As Long)
Debug.Print "TabStrip2.Index: " & Index
End Sub
Private Sub UserForm_Initialize()
TabStrip1.Tabs(0).Caption = "Incident 1"
TabStrip1.Tabs(1).Caption = "Incident 2"
TabStrip2.Tabs(0).Caption = "Action 1"
TabStrip2.Tabs(1).Caption = "Action 2"
End Sub |
Partager