radikal64
Messages postés7Date d'inscriptionjeudi 22 mars 2007StatutMembreDernière intervention 4 octobre 2010
-
27 sept. 2010 à 14:26
radikal64
Messages postés7Date d'inscriptionjeudi 22 mars 2007StatutMembreDernière intervention 4 octobre 2010
-
27 sept. 2010 à 14:49
Bonjour,
Je suis désolé mais je n'arrive pas à trouver de solution à mon soucis malgré mes recherches.
J'espère que vous pourrez m'aider.
Je cherche en fait à mettre en face de chaque label deux optionbutton en face d'un label et donc j'ai essayé de les mettre dans une frame, mais lors de l'exécution seule la première frame contient des boutons.
Voici le code:
Sub UserForm_initialize()
Dim i, j, k, l, m, n As Integer
Dim Top, Left, Width, Height, hauteur, numero_label, nb_label As Integer
Dim Numerolabel As Integer
Dim UserForm3 As Object
Dim bouton_ok As msforms.OptionButton
Dim bouton_nok As msforms.OptionButton
Dim Frme As msforms.Frame
Dim label As msforms.label
Sheets("Suivi").Select
With Me
.Caption = "Contrôle journalier"
.Width = 500
End With
nb_label = Range("AN1").End(xlDown).Row
numero_label = 0
hauteur = 0
For i = 1 To nb_label
numero_label = numero_label + 1
Set label = Me.Controls.Add("Forms.Label.1", "label" & numero_label) ' creation automatique du label nommé numero_label
With label
.Width = 200
.Height = 20
.Top = hauteur + 5
.Left = 110 ' label à afficher 100 pixels à gauche
.Caption = Cells(i, 40)
End With
Set Frme = Me.Controls.Add("Forms.Frame.1", "Frame" & numero_label)
With Frme
.Left = 10
.Top = hauteur
.Width = 90
.Height = 20
End With
Set bouton_ok = Frme.Controls.Add("Forms.Optionbutton.1", "bouton_ok" & numero_label)
With bouton_ok
.Width = 40
.Height = 20
.Top = hauteur
.Left = 10
.Caption = "OK"
End With
Set bouton_nok = Frme.Controls.Add("Forms.Optionbutton.1", "bouton_nok" & numero_label)
With bouton_nok
.Width = 40
.Height = 20
.Top = hauteur
.Left = 50
.Caption = "NOK"
End With
hauteur = hauteur + 20
Next i
With Me
.Height = hauteur + 100
End With
Set bouton_1 = Me.Controls.Add("Forms.CommandButton.1", "bouton")
With bouton_1
.Width = 60
.Height = 40
.Top = hauteur + 20
.Left = 200
.Caption = "OK"
End With
End Sub