+ Reply to Thread
Results 1 to 2 of 2

Compile error : object required in userform

Hybrid View

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

    Compile error : object required in userform

    Greetings,

    I get the subject compile error at the line:

    Set sFraName = Fr.Name
    The code is:

    Private Sub NameEnabledFrame()
        Call CountFrames
        For i = 2 To iCountFra
            Set Fr = Me.Controls("Frame" & i)
                If Fr.Enabled = True Then
                    Set sFraName = Fr.Name
                End If
        Next
    End Sub
    The variables are declared at the top of the userform module after "Option Explicit"

    Dim iCountFra As Integer          'Number of frames in the userform
    Dim sFraName As String            'Name of the frame enabled as per optionbutton selection
    Dim i As Integer
    Dim Fr As MSForms.Frame
    Can someone please tell me why I am getting the error?

    Many thanks
    Asha

    Last edited by asha3010; 07-09-2010 at 04:11 AM.

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

    Re: Compile error : object required in userform

    The error was resolved when I changed the code from:

    Set sFraName = Fr.Name
    to

    sFraName = Fr.Name
    I guess that it because "Set" is not to be used for string variables?

    Many thanks
    Asha
    Last edited by asha3010; 07-09-2010 at 04:10 AM.

+ Reply to Thread

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