Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Form variables 1

Status
Not open for further replies.
Jan 28, 2003
149
GB
Hi

Short and sweet - What's the best way of getting the results of a UserForm back to the calling procedure.

At present I can't get them back to the calling procedure (which I want to do for tidyness) - I have to call another procedure from the form's closing code.

Thanks in advance

B.M.
 
You can define public values in a standard module and change them in UserForm module.

Another option - hide userform, read its settings and unload it. Having userform1 with checkbox1 and commandbutton1 and code:
[tt]Private Sub CommandButton1_Click()
Me.Hide
End Sub[/tt]
and standard module with:
[tt]Sub GetUFValue()
UserForm1.Show
MsgBox UserForm1.CheckBox1.Value
Unload UserForm1
End Sub[/tt]
you get setting of checkbox.

combo
 
For DoubleVarName variable declared as Double type:

Public DoubleVarName As Double

combo
 
I get "invalid attribute in Sub or Function" when I try that - am I trying to put it in the wrong place???

B.M.
 
The variable should be declared at the module level in declarations section, i.e. outside and before any procedure.

combo
 
Thanks combo, I just worked that out as you were typing.

Cheers

B.M.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top