es werden frame, comboboxen und commandbutton erstellt :
Dim ctl As Control
Set ctl = Controls.Add("forms.frame.1", "frm2", True)
With ctl
.Left = 20
.Top = 20
.Width = 550
.Height = 490
.Font.Bold = True
.Font.Name = "Tahoma"
.Font.Size = 10
.BackColor = RGB(205, 205, 193)
.Caption = " TÄGLICHE AUFGABEN "
End With
...
Set ctl = Controls("frm2").Controls.Add("forms.combobox.1", "cboboxsaperp1", True)
With ctl
.Left = 225
.Top = 40
.Width = 80
.Height = 18
.Font.Bold = False
.Font.Name = "Tahoma"
.Font.Size = 9
.BackColor = RGB(255, 255, 255)
.TextAlign = 1
.TabStop = True
.TabIndex = 1
.MaxLength = 10
.Locked = False
.Style = 2
' .Value = "OFFEN" ersetzt durch '* ALLE Cobmoboxen auf "OFFEN" stellen
End With
ctl.AddItem "OFFEN"
ctl.AddItem "ERLEDIGT"
...
Set ctlOK1 = Controls("frm2").Controls.Add("forms.commandbutton.1", _
"cmdOK1", True)
With ctlOK1
.Left = 320
.Top = 40
.Width = 45
.Height = 18
.Font.Bold = False
.Font.Name = "Tahoma"
.Font.Size = 8
.BackColor = RGB(205, 205, 193)
.TabStop = True
.TabIndex = 2
.Locked = True .Caption = "OK"
.Cancel = True
End With
...
wenn ich in der frame die combobox auswerten möchte passiert nichts, schiebe ich aber die combobox und die commandbottun direkt in die userform dann klappt es :
Private Sub cboboxsaperp1_Change()
If cboboxsaperp1.Value = "OFFEN" Then
cmdOK1.Locked = True
Else
cmdOK1.Locked = False
End If
End Sub
wie in der frm2 ?
danke eric1