E
ExcelMonkey
I need some advice on this task.
I have a listbox with 21 items. When I click onto an item, I want a unique
userform to display - for that item - with additional parameters for the user
to click. So each item brings up its own additional userform. Now I am
assuming I can approach this two ways:
1) Build 21 additional userforms programmatically
2) Build one very large form with all the controls that is called each time
an item is clicked and will hide unwanted controls.
Assuming option 2 is the way to go, do I have to create 21 click events for
each item in the listbox? Or can this be accomplished using a class module?
Each listbox item will have a unique number an type of controls. So I am not
sure if a class module works. So assuming I create 21 click events, I am
assuming that I will have to build a function which makes the appropriate
changes to the userform before it is loaded. However I will need the option
to pass the unique number of controls to this function.
Function Design_Userform(Optional A as Contorl, Optional B as Control,
Optional C As Control, Optional D as Control, Optional E as Control)
For each cntrl in Controls
'Code to hide the controls that are not needed based on
'IF stmt which hides all controls unless they are the ones passed
'to this function
Next
'Code to place controls where needed. Assume they will simply
'run vertically down form
'Code to size form to accomodate contrls placed
End
And then lastly I am assuming that I have to pass all control box data to
public variables as I need to retain the values while the user finishings
calling up the userform for the remaining listbox items. So there will be an
"OK" button on the additonal userform to pass this data to the public
variables.
Any ideas on how to get this going?
Thanks
EM
I have a listbox with 21 items. When I click onto an item, I want a unique
userform to display - for that item - with additional parameters for the user
to click. So each item brings up its own additional userform. Now I am
assuming I can approach this two ways:
1) Build 21 additional userforms programmatically
2) Build one very large form with all the controls that is called each time
an item is clicked and will hide unwanted controls.
Assuming option 2 is the way to go, do I have to create 21 click events for
each item in the listbox? Or can this be accomplished using a class module?
Each listbox item will have a unique number an type of controls. So I am not
sure if a class module works. So assuming I create 21 click events, I am
assuming that I will have to build a function which makes the appropriate
changes to the userform before it is loaded. However I will need the option
to pass the unique number of controls to this function.
Function Design_Userform(Optional A as Contorl, Optional B as Control,
Optional C As Control, Optional D as Control, Optional E as Control)
For each cntrl in Controls
'Code to hide the controls that are not needed based on
'IF stmt which hides all controls unless they are the ones passed
'to this function
Next
'Code to place controls where needed. Assume they will simply
'run vertically down form
'Code to size form to accomodate contrls placed
End
And then lastly I am assuming that I have to pass all control box data to
public variables as I need to retain the values while the user finishings
calling up the userform for the remaining listbox items. So there will be an
"OK" button on the additonal userform to pass this data to the public
variables.
Any ideas on how to get this going?
Thanks
EM