excel - How can I reference a dynamically created control in VBA? -


i've been finding answers need here on stackoverflow months (thank all!) far search terms aren't finding result need time... hence, first post here...

i have excel file includes 2 userforms:

  • the first used input invoice data , export data in format can uploaded our proprietary accounting system.
  • the second later used post payment data against invoices , then, similarly, export data in format can uploaded our accounting system.

the second form has created dynamically in userform_initialize, because number of payments required (and, thus, number of textbox , label controls created) varies depending on size of invoices. i've finished code create second form , works well, i'd add functionality triggered when of these dynamically created controls changed user.

i've done in other forms using given control's _change() procedure (for example, when want move next box after entering dollar amount, use _change() setfocus elsewhere value has 2 digits after decimal). question is: how can establish _change()-style procedures controls don't yet exist before form initialized? there way set "global" _change() procedure can use loop through text boxes , use if/then/else statements based on dynamic names?

any tips appreciated!

when using dynamic forms, create object arrays store relevant information can , reference objects "name".


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -