Results 1 to 3 of 3

Thread: Capturing runtime created control events

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    13

    Capturing runtime created control events

    I'm adding controls at runtime but need to be able to capture their events. For example.

    Set mycmd = Controls("Frame" & (x)).Add("Forms.CheckBox.1")

    How do i capture the click event from this newly formed check box.

    i tried to name it and write code based on thAt name but i't doesn't work

    ie

    mycmd.name = "newcheck"&x

    Private Sub newcheck1_Click()
    Call whatever
    End Sub

    this won't work.

    Anyone have any idea on how to do this, even an idea of were i could find how to do this?

    Thanks
    -Ted

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538

    Talking

    I susspect you're missing the withevents keyword for this.

    Try taking a look at Tom's post here :http://www.vbforums.com/showthread.p...hreadid=235463

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2003
    Posts
    13
    WOW I've been programming Excel since 97 and I consider myself to be a good programer and never did figure this one out. I tried the withevents before but for one reason or another it never worked. Guess I gave up to soon. Thanks!!!!!!!!!!!!!!

Posting Permissions

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



Click Here to Expand Forum to Full Width