Sub TEST_iMAGE()
'
' TEST_iMAGE Macro
'
Selection.OnAction = "Image1_Clic"
End Sub
Sub Macro2()
'
' Macro2 Macro
'
'
ActiveSheet.Shapes.Range(Array("Rounded Rectangle 14")).Select
Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "Moi même"
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 8). _
ParagraphFormat
.BaselineAlignment = msoBaselineAlignAuto
.SpaceWithin = 1
.SpaceBefore = 0
.SpaceAfter = 0
.FirstLineIndent = 0
.Alignment = msoAlignCenter
.HangingPunctuation = msoTrue
End With
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 3).Font
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.ObjectThemeColor = msoThemeColorLight1
.Fill.ForeColor.TintAndShade = 0
.Fill.ForeColor.Brightness = 0
.Fill.Transparency = 0
.Fill.Solid
.Size = 11
.Name = "+mn-lt"
End With
With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(4, 5).Font
.BaselineOffset = 0
.NameComplexScript = "+mn-cs"
.NameFarEast = "+mn-ea"
.Fill.Visible = msoTrue
.Fill.ForeColor.ObjectThemeColor = msoThemeColorLight1
.Fill.ForeColor.TintAndShade = 0
.Fill.ForeColor.Brightness = 0
.Fill.Transparency = 0
.Fill.Solid
.Size = 11
.Name = "+mn-lt"
End With
Range("F4").Select
End Sub
Sub Macro3()
'
' Macro3 Macro
'
'
ActiveSheet.Shapes.Range(Array("Picture 1")).Select
Range("L9").Select
End Sub
Private Sub CommandButton1_Click() 'Valider
Dim Ws As Worksheet, Utilisateur$, j&
Application.ScreenUpdating = 0
If TextBox2 = ComboBox1.Column(1) Then
If ComboBox1.Column(2) = "Niveau 1" Then
j = 3
'Call Affiche_tt_Feuilles
ElseIf ComboBox1.Column(2) = "Niveau 2" Then j = 2
ElseIf ComboBox1.Column(2) = "Niveau 3" Then j = 1
ElseIf ComboBox1.Column(2) = "Niveau 4" Then GoTo Suite
End If
Else
MsgBox "Le mot de passe n'est pas correcte"
TextBox2.SetFocus
Exit Sub
End If
For i = 0 To j
Sheets(1).Shapes("CommandButton" & Bt(i)).Select
Selection.Enabled = -1
Next
Suite:
[A1].Activate
Unload Me
Application.ScreenUpdating = -1
End Sub
Private Sub CommandButton1_Click() 'Valider
'Déclaration des variables
Dim Ws As Worksheet, Utilisateur$, j&
'Mise à jour de l'écran non validée
Application.ScreenUpdating = 0
'Si le TextBox2 = la Colonne 2 du ComboBox1 (puisque nous avons un ComboBox1 multi colonne)
If TextBox2 = ComboBox1.Column(1) Then
'Si la 3ème colonne du ComboBox1 correspond à "Niveau 1", alors ...
If ComboBox1.Column(2) = "Niveau 1" Then
'j = 3 correspond à la totalité des actions
j = 3
'Lorsque ce n'est pas mis en commentaire comme tu l'as fais, ça affiche toutes les feuilles
'Call Affiche_tt_Feuilles
'Si la 3ème colonne du ComboBox1 correspond à "Niveau 2", alors ... j = 2
ElseIf ComboBox1.Column(2) = "Niveau 2" Then j = 2
'Idem ci-dessus
ElseIf ComboBox1.Column(2) = "Niveau 3" Then j = 1
ElseIf ComboBox1.Column(2) = "Niveau 4" Then GoTo Suite
End If
Else 'Sinon mot de passe incorrecte
MsgBox "Le mot de passe n'est pas correcte"
TextBox2.SetFocus
Exit Sub
End If
'Lorsque nous avons définit le j, nous pouvons afficher les boutons
For i = 0 To j 'De 0 à j (soit 1, 2, 3 ou 4)
'Bt est un tableau ou array définit au lancement du fichier et déclaré en variable Public (donc accessible à tout moment)
'Nous sélectionnons le bouton en question
Sheets(1).Shapes("CommandButton" & Bt(i)).Select
'Puis nous lui donnons la valeur Vrai
Selection.Enabled = -1
Next
Suite:
[A1].Activate
Unload Me
Application.ScreenUpdating = -1
End Sub
Quand tu dis que ta feuille EDITO est protégée, elle l'était aussi lorsque tu faisais les tests avec mon fichier ? Car si oui, cela vient peut-être de là.
A+