PDA

View Full Version : Parameters from Userform



CADfunk MC
2010-04-23, 08:14 PM
Hi All

What I am trying to achieve at the moment, is to use the number of the string in my combobox to calculate the attributes that are to be edited. But I don't know how to pass this number on to the sub in wich the attributes will be edited. Has anybody got any experience with this? Is it possible?


Public Sub UserForm_Initialize()

Dim CBOarray As Variant
Dim intIndex As Integer
Dim CntCalc As Integer
CBOarray = Array("A", "B", "C", "D", "E", "F", "G", "H", "I", "J")

For intIndex = LBound(CBOarray) To UBound(CBOarray)
Call Me.cboscript.AddItem(CBOarray(intIndex))
CntCalc = intIndex * 4
Next intIndex

End Sub

Ed Jobe
2010-04-23, 08:36 PM
What I usually do is to make the variable you want to expose, a property of the form. Then, instead of the form's Close button unloading the form, you hide it. At that point control passes from the form to the calling sub, where you can access the form's property. Then you unload the form.

CADfunk MC
2010-04-26, 06:25 PM
Thanks, that got me where I needed to be. No parameters required.