+ Reply to Thread
Results 1 to 5 of 5

Acessing dynamically created form controls

  1. #1
    Registered User
    Join Date
    10-08-2014
    Location
    Lake Havasu City, AZ
    MS-Off Ver
    Office 365
    Posts
    23

    Acessing dynamically created form controls

    I am creating form controls in a custom userform and have having difficulty in accesing them after creation. The amount of ComboBoxes and TextBoxes depends on user input. I am using a CommandButton to figure the correct syntax, but am at a loss to find the control. I have used several different naming conventions inside the CommandButton_Click method and nothing works.

    My code for the userform to create my controls is as follows:

    Please Login or Register  to view this content.
    The code for the CommndButton is which doesn't work is:

    Please Login or Register  to view this content.
    Any help is greatly appreciated.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Acessing dynamically created form controls

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

    The First line (bolded) should work. The other three shouldn't as they don't represent the correct name or syntax.
    Last edited by AlphaFrog; 06-12-2017 at 10:34 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    10-08-2014
    Location
    Lake Havasu City, AZ
    MS-Off Ver
    Office 365
    Posts
    23

    Re: Acessing dynamically created form controls

    When I said doesn't work I should have been more specific. When I click the command button with only the first line in the sub, nothing happens. I don't receive any errors and the textbox does not update. I am at a loss.

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Acessing dynamically created form controls

    I created the controls with your createDetails code and this line worked for me

    Please Login or Register  to view this content.
    You should have received an error with any of the other three lines.

  5. #5
    Registered User
    Join Date
    10-08-2014
    Location
    Lake Havasu City, AZ
    MS-Off Ver
    Office 365
    Posts
    23

    Re: Acessing dynamically created form controls

    I received errors on all three of the other lines. I have been talking with other users and the code works fine for them. I think I have a "bug" somewhere in one of my other procedures. I am going to rewrite one control at a time.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using Class Module for handling events of dynamically created controls
    By jagman in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-17-2018, 01:14 PM
  2. [SOLVED] Update labels caption with dynamically created controls on mulitpage userform
    By Chrispelletier in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-29-2016, 02:53 PM
  3. place dynamically created controls in row and column into the userform with in the frame
    By gokulkrishi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-02-2016, 01:38 AM
  4. Replies: 0
    Last Post: 06-22-2014, 04:18 PM
  5. [SOLVED] userForm -> Frame 'top' value limited. Dynamically created controls,
    By kropeck in forum Excel Programming / VBA / Macros
    Replies: 29
    Last Post: 08-19-2013, 09:04 AM
  6. Add MouseMove action to dynamically created form controls
    By AdLoki in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-19-2013, 09:09 AM

Tags for this Thread

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