Theiks
01-22-2012, 02:25 PM
How can I return a value from a modal form in VBA.
Here is the code I used in VB6:
Begin VB.Form Form2
....
Public sText As String
Private Sub Text1_Change()
sText = Text1.Text
End Sub
VERSION 1.0 CLASS
...
Private m_Text
Public Property Get Text() As String
Text = m_Text
End Property
Sub GetText()
Dim frm As New Form2
frm.Show 1
x = frm.sText
m_Text = frm.sText
End Sub
First question: Why can I set x to frm.sText after frm is closed?
and How do yo do this in VBA?
Thanks.
Here is the code I used in VB6:
Begin VB.Form Form2
....
Public sText As String
Private Sub Text1_Change()
sText = Text1.Text
End Sub
VERSION 1.0 CLASS
...
Private m_Text
Public Property Get Text() As String
Text = m_Text
End Property
Sub GetText()
Dim frm As New Form2
frm.Show 1
x = frm.sText
m_Text = frm.sText
End Sub
First question: Why can I set x to frm.sText after frm is closed?
and How do yo do this in VBA?
Thanks.