AccessTr.neT

Tam Versiyon: Buton İle Frame Backcolor Değiştirmek
Şu anda arşiv modunu görüntülemektesiniz. Tam versiyonu görüntülemek için buraya tıklayınız.
Private Sub CommandButton1_Click()
    Dim ctl As Control
    For Each ctl In Me.Form
        If ctl.ControlType = acBoundObjectFrame Then
            If (ctl.Name = Me.TextBox1.Value) Then
                ctl.BackColor = GetHexColor(Me.TextBox2.Value)
            End If
        End If
    Next ctl
    Set ctl = Nothing
End Sub



bu kod ile Excelde
"Me.TextBox1.Value" değerine formdan manuel olarak "Frame8" 
"Me.TextBox2.Value" değerine formdan manuel olarak "#AAECDF"  yazacağım butona bastığımda rengi değişecek kodda 
"Me.Form" ve "acBoundObjectFrame" kalimelerinde hata veriyor nasıl yazmam lazım
Me.Form --->  Me.Controls olacakmış
ama frame controlunun karşılığını bulamadım
acFrame olmalı diye düşünüyorum ama olmuyor
şeyle bir kod var

Private Sub dene()
    Dim ctrl As Control
    For Each ctrl In Frame1.Controls
        If TypeOf ctrl Is MSForms.OptionButton Then
            If ctrl.Enabled = True Then
                MsgBox ctrl.Name & " is an enabled OptionButton with caption " & ctrl.Caption
            End If
        End If
    Next
End Sub
böyle yazdım oldu

Private Sub CommandButton1_Click()
    changeColor Me.TextBox1.Value, Me.TextBox2.Value
End Sub

Private Sub changeColor(controlName As String, colorName As String)
    Dim ctrl As Control
    For Each ctrl In Me.Controls
        If TypeOf ctrl Is MSForms.Frame Then
            If ctrl.Enabled = True Then
                If (ctrl.Name = controlName) Then
                    ctrl.BackColor = GetHexColor(colorName)
                End If
            End If
        End If
    Next
End Sub