Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms - how to return a value?
I've seen that one usually runs Me.Hide inside the OK_Click or
Cancel_Click method, but is it somehow possible to specify a return value the Show method will return, like MsgBox does for example? Also, is it possible to specify arguments to UserForm.Show so that the form knows how to initialize itself, without having to make an extra code module that's just there to show the dialog? Or is it perhaps possible to have a public "static" function inside a Dialog module that one can call at any time and that does the creation of the dialog? I didn't succeed when I tried to define a function there and call it from outside. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms - how to return a value?
The standard way is to have a public property in the form and test that
afterwards Dim myForm As UserForm1 If myForm Is Nothing Then Set myForm = New UserForm1 myForm.Show MsgBox myForm.myProp Set myForm = Nothing In the form have a public variable Public myProp as Boolean and set it in the form code. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Marcus Schöneborn" wrote in message . uni-frankfurt.de... I've seen that one usually runs Me.Hide inside the OK_Click or Cancel_Click method, but is it somehow possible to specify a return value the Show method will return, like MsgBox does for example? Also, is it possible to specify arguments to UserForm.Show so that the form knows how to initialize itself, without having to make an extra code module that's just there to show the dialog? Or is it perhaps possible to have a public "static" function inside a Dialog module that one can call at any time and that does the creation of the dialog? I didn't succeed when I tried to define a function there and call it from outside. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms - how to return a value?
»Bob Phillips« wrote:
The standard way is to have a public property in the form and test that afterwards Dim myForm As UserForm1 If myForm Is Nothing Then Set myForm = New UserForm1 myForm.Show MsgBox myForm.myProp Set myForm = Nothing In the form have a public variable Public myProp as Boolean and set it in the form code. That's what I am doing at the moment. I hoped there was another way to do that... Well, then it's fine. Thanks. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms - how to return a value?
You could set up properties, which I use to pass information into and out of
the form: http://peltiertech.com/Excel/PropertyProcedures.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Marcus Schöneborn" wrote in message . uni-frankfurt.de... »Bob Phillips« wrote: The standard way is to have a public property in the form and test that afterwards Dim myForm As UserForm1 If myForm Is Nothing Then Set myForm = New UserForm1 myForm.Show MsgBox myForm.myProp Set myForm = Nothing In the form have a public variable Public myProp as Boolean and set it in the form code. That's what I am doing at the moment. I hoped there was another way to do that... Well, then it's fine. Thanks. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms - how to return a value?
Uhh, isn't that what I said 2 hours 44 minutes earlier, and the OP said was
what he was doing? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... You could set up properties, which I use to pass information into and out of the form: http://peltiertech.com/Excel/PropertyProcedures.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Marcus Schöneborn" wrote in message . uni-frankfurt.de... »Bob Phillips« wrote: The standard way is to have a public property in the form and test that afterwards Dim myForm As UserForm1 If myForm Is Nothing Then Set myForm = New UserForm1 myForm.Show MsgBox myForm.myProp Set myForm = Nothing In the form have a public variable Public myProp as Boolean and set it in the form code. That's what I am doing at the moment. I hoped there was another way to do that... Well, then it's fine. Thanks. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms - how to return a value?
Bob -
You said public property, but I thought you demonstrated a public variable. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... Uhh, isn't that what I said 2 hours 44 minutes earlier, and the OP said was what he was doing? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... You could set up properties, which I use to pass information into and out of the form: http://peltiertech.com/Excel/PropertyProcedures.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Marcus Schöneborn" wrote in message . uni-frankfurt.de... »Bob Phillips« wrote: The standard way is to have a public property in the form and test that afterwards Dim myForm As UserForm1 If myForm Is Nothing Then Set myForm = New UserForm1 myForm.Show MsgBox myForm.myProp Set myForm = Nothing In the form have a public variable Public myProp as Boolean and set it in the form code. That's what I am doing at the moment. I hoped there was another way to do that... Well, then it's fine. Thanks. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms - how to return a value?
In a class, a public variable is a read/write property.
-- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... Bob - You said public property, but I thought you demonstrated a public variable. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... Uhh, isn't that what I said 2 hours 44 minutes earlier, and the OP said was what he was doing? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... You could set up properties, which I use to pass information into and out of the form: http://peltiertech.com/Excel/PropertyProcedures.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Marcus Schöneborn" wrote in message . uni-frankfurt.de... »Bob Phillips« wrote: The standard way is to have a public property in the form and test that afterwards Dim myForm As UserForm1 If myForm Is Nothing Then Set myForm = New UserForm1 myForm.Show MsgBox myForm.myProp Set myForm = Nothing In the form have a public variable Public myProp as Boolean and set it in the form code. That's what I am doing at the moment. I hoped there was another way to do that... Well, then it's fine. Thanks. |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms - how to return a value?
Yes, in that sense it is a property. I was thinking more in the sense of the
property Let/Set/Get procedures, which I use a lot because they let you do more than pass a value. You can use a procedure to set up the display on the userform, maybe set values for multiple procedures, drive other events. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... In a class, a public variable is a read/write property. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... Bob - You said public property, but I thought you demonstrated a public variable. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... Uhh, isn't that what I said 2 hours 44 minutes earlier, and the OP said was what he was doing? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... You could set up properties, which I use to pass information into and out of the form: http://peltiertech.com/Excel/PropertyProcedures.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Marcus Schöneborn" wrote in message . uni-frankfurt.de... »Bob Phillips« wrote: The standard way is to have a public property in the form and test that afterwards Dim myForm As UserForm1 If myForm Is Nothing Then Set myForm = New UserForm1 myForm.Show MsgBox myForm.myProp Set myForm = Nothing In the form have a public variable Public myProp as Boolean and set it in the form code. That's what I am doing at the moment. I hoped there was another way to do that... Well, then it's fine. Thanks. |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms - how to return a value?
I agree that Get/Let/Set gives you the capability to process the property a
great deal more. I too use them, almost exclusively, but for what the OP wanted here, a simple read/.write property was sufficient, and let's be honest, it is never much work to convert them over later if need be. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... Yes, in that sense it is a property. I was thinking more in the sense of the property Let/Set/Get procedures, which I use a lot because they let you do more than pass a value. You can use a procedure to set up the display on the userform, maybe set values for multiple procedures, drive other events. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... In a class, a public variable is a read/write property. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... Bob - You said public property, but I thought you demonstrated a public variable. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... Uhh, isn't that what I said 2 hours 44 minutes earlier, and the OP said was what he was doing? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... You could set up properties, which I use to pass information into and out of the form: http://peltiertech.com/Excel/PropertyProcedures.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Marcus Schöneborn" wrote in message . uni-frankfurt.de... »Bob Phillips« wrote: The standard way is to have a public property in the form and test that afterwards Dim myForm As UserForm1 If myForm Is Nothing Then Set myForm = New UserForm1 myForm.Show MsgBox myForm.myProp Set myForm = Nothing In the form have a public variable Public myProp as Boolean and set it in the form code. That's what I am doing at the moment. I hoped there was another way to do that... Well, then it's fine. Thanks. |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms - how to return a value?
Yeah, I guess we're both right. You can't beat the ease of converting, when
MZ Tools has a command to do just that. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... I agree that Get/Let/Set gives you the capability to process the property a great deal more. I too use them, almost exclusively, but for what the OP wanted here, a simple read/.write property was sufficient, and let's be honest, it is never much work to convert them over later if need be. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... Yes, in that sense it is a property. I was thinking more in the sense of the property Let/Set/Get procedures, which I use a lot because they let you do more than pass a value. You can use a procedure to set up the display on the userform, maybe set values for multiple procedures, drive other events. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... In a class, a public variable is a read/write property. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... Bob - You said public property, but I thought you demonstrated a public variable. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... Uhh, isn't that what I said 2 hours 44 minutes earlier, and the OP said was what he was doing? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... You could set up properties, which I use to pass information into and out of the form: http://peltiertech.com/Excel/PropertyProcedures.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Marcus Schöneborn" wrote in message . uni-frankfurt.de... »Bob Phillips« wrote: The standard way is to have a public property in the form and test that afterwards Dim myForm As UserForm1 If myForm Is Nothing Then Set myForm = New UserForm1 myForm.Show MsgBox myForm.myProp Set myForm = Nothing In the form have a public variable Public myProp as Boolean and set it in the form code. That's what I am doing at the moment. I hoped there was another way to do that... Well, then it's fine. Thanks. |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
UserForms - how to return a value?
Amen to that, indispensable.
-- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... Yeah, I guess we're both right. You can't beat the ease of converting, when MZ Tools has a command to do just that. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... I agree that Get/Let/Set gives you the capability to process the property a great deal more. I too use them, almost exclusively, but for what the OP wanted here, a simple read/.write property was sufficient, and let's be honest, it is never much work to convert them over later if need be. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... Yes, in that sense it is a property. I was thinking more in the sense of the property Let/Set/Get procedures, which I use a lot because they let you do more than pass a value. You can use a procedure to set up the display on the userform, maybe set values for multiple procedures, drive other events. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... In a class, a public variable is a read/write property. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... Bob - You said public property, but I thought you demonstrated a public variable. - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Bob Phillips" wrote in message ... Uhh, isn't that what I said 2 hours 44 minutes earlier, and the OP said was what he was doing? -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jon Peltier" wrote in message ... You could set up properties, which I use to pass information into and out of the form: http://peltiertech.com/Excel/PropertyProcedures.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions Peltier Technical Services, Inc. - http://PeltierTech.com _______ "Marcus Schöneborn" wrote in message . uni-frankfurt.de... »Bob Phillips« wrote: The standard way is to have a public property in the form and test that afterwards Dim myForm As UserForm1 If myForm Is Nothing Then Set myForm = New UserForm1 myForm.Show MsgBox myForm.myProp Set myForm = Nothing In the form have a public variable Public myProp as Boolean and set it in the form code. That's what I am doing at the moment. I hoped there was another way to do that... Well, then it's fine. Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Return values from UserForms | Excel Programming | |||
userforms | Excel Programming | |||
userforms | Excel Programming | |||
userforms | Excel Programming | |||
userforms again... | Excel Programming |