Results 1 to 12 of 12

Syntax for returning Optionbutton (Userform) caption (Error 438 with ctr.value)

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-09-2010
    Location
    Constanta
    MS-Off Ver
    Excel 2007
    Posts
    128

    Syntax for returning Optionbutton (Userform) caption (Error 438 with ctr.value)

    Greetings,

    I would like to return the name of the optionbutton that has been selected in Frame1. In addition to other optionbuttons, a textbox and combobox are included in the frame.

    I used the following code:

    Private Sub Label15_Click()
    Dim sAction As String
    
    For Each ctr In Me.Frame1.Controls
            If TypeOf ctr Is MSForms.OptionButton And ctr.Value = True Then
                sAction = ctr.Caption
            End If
        Next
    Range("A3") = sAction
    End Sub
    But I get a run-time error 438 : object doesn't support this property or method. When I changed

    ctr.Value
    to
    ctr.Object
    I was able to get the desired result. I am trying to understand why I would not get the desired result using the "Value" property.

    Attached is a sample file.

    Thanks for your help.
    Asha

    Attached Files Attached Files
    Last edited by asha3010; 07-13-2010 at 08:17 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1