+ Reply to Thread
Results 1 to 3 of 3

Creating Userform Controls on Frame

  1. #1
    David Myle
    Guest

    Creating Userform Controls on Frame

    Hi all,

    How can I create "on the fly" other controls on a Frame, if the frame itself
    is to be created on the fly. The following code (simplified to create a
    CheckBox on a Frame) failed.

    Private Sub Userform_Initialize()
    Dim x as Control, y as Control
    Set x = Me.Controls.Add("Forms.Frame1.1")
    Set y = Me..Frame1.Controls.Add("Forms.CheckBox1.1")
    End Sub

    The code balks at "Frame1" with "Method or data member not found" error
    message. Apparently, the code fails to detect the Frame purported to have
    been created earlier.

    Any help will be appreciated.



  2. #2
    Tom Ogilvy
    Guest

    Re: Creating Userform Controls on Frame

    The code you purport to partially work appears to have errors. Anyway, this
    worked for me:

    Private Sub Userform_Initialize()
    Dim x As Control, y As Control
    Set x = Me.Controls.Add("Forms.Frame.1", Name:="Frame1")
    Set y = x.Controls.Add("Forms.CheckBox.1", Name:="Chkbx1")
    End Sub

    --
    Regards,
    Tom Ogilvy


    "David Myle" <[email protected]> wrote in message
    news:[email protected]...
    > Hi all,
    >
    > How can I create "on the fly" other controls on a Frame, if the frame

    itself
    > is to be created on the fly. The following code (simplified to create a
    > CheckBox on a Frame) failed.
    >
    > Private Sub Userform_Initialize()
    > Dim x as Control, y as Control
    > Set x = Me.Controls.Add("Forms.Frame1.1")
    > Set y = Me..Frame1.Controls.Add("Forms.CheckBox1.1")
    > End Sub
    >
    > The code balks at "Frame1" with "Method or data member not found" error
    > message. Apparently, the code fails to detect the Frame purported to have
    > been created earlier.
    >
    > Any help will be appreciated.
    >
    >




  3. #3
    David Myle
    Guest

    Re: Creating Userform Controls on Frame

    Many thanks Tom.

    DM


    "Tom Ogilvy" <[email protected]> wrote in message
    news:[email protected]...
    > The code you purport to partially work appears to have errors. Anyway,

    this
    > worked for me:
    >
    > Private Sub Userform_Initialize()
    > Dim x As Control, y As Control
    > Set x = Me.Controls.Add("Forms.Frame.1", Name:="Frame1")
    > Set y = x.Controls.Add("Forms.CheckBox.1", Name:="Chkbx1")
    > End Sub
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "David Myle" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hi all,
    > >
    > > How can I create "on the fly" other controls on a Frame, if the frame

    > itself
    > > is to be created on the fly. The following code (simplified to create a
    > > CheckBox on a Frame) failed.
    > >
    > > Private Sub Userform_Initialize()
    > > Dim x as Control, y as Control
    > > Set x = Me.Controls.Add("Forms.Frame1.1")
    > > Set y = Me..Frame1.Controls.Add("Forms.CheckBox1.1")
    > > End Sub
    > >
    > > The code balks at "Frame1" with "Method or data member not found" error
    > > message. Apparently, the code fails to detect the Frame purported to

    have
    > > been created earlier.
    > >
    > > Any help will be appreciated.
    > >
    > >

    >
    >




+ 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