+ Reply to Thread
Results 1 to 2 of 2

Adding code to a form on the fly...

  1. #1
    Registered User
    Join Date
    03-01-2007
    Posts
    2

    Adding code to a form on the fly...

    Hello,

    I have a nifty little userform that contains a tabstrip. I want the user to be able to add and remove tabs as required. Each tab contains controls (textboxes and comboboxes) and the controls contain event code (_change mostly).

    I am successfully adding the tab and the controls, I can navigate them and interact with them. However when I add the code and attempt to access the new tab after the code was added (using vbe codemodule object) the userform appears to crash and I get an error stating...

    Run-time error '-2147417848 (80010108)':
    Automation error
    The object invoked has disconnected from its clients.

    When I enter the debugger and attempt to compile, it errors on the controls that were created on the fly as not being defined (since the userform crashed I assume they are gone now).

    Do I need to save the workbook and somehow recompile after I create the controls so they "really" exist, before I place event code on them? I guess I'm looking for assistance on the approach rather than simply throwing code at you all. If the approach seems sound, then I publish the code for assistance.

    Thanks,
    Ara

  2. #2
    Registered User
    Join Date
    03-01-2007
    Posts
    2
    I decided on changing the approach. I now have command buttons that perform the _Change events code. So I now don't need to add code on the fly.

    Not as cool, but works great.

+ 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