J
John
I want to call a form from a procedure, selected the value of a
variable in the form, and pass the value back to the procedure. How can
I do this?
Here is what I've tried.
--------calling proc-----------
Public strVariable as String
Sub CallingProcedure()
Dim procVar1 as string
...
strVariable=""
frmUserForm14.Show vbModeless
cellLinkI = strVariable
...
End Sub
------------------------------
----code in frmUserForm14-----
(no declarations)
Public butOkay_Click()
Dim strFormVar as String
strFormVar=""
If strFormVar="X" Then
strVariable=strFormVar
Else
strVariable="Z"
End If
Unload Me
End Sub
------------------------------
When this code is run, the value of strVariable after the call is "".
Another way to do this might be to call the form with the variable
"ByRef" so that it is returned to the variable in the calling
procedure.
Maybe the problem is that the Form is not a Module.
Thank you.
John Wirt
variable in the form, and pass the value back to the procedure. How can
I do this?
Here is what I've tried.
--------calling proc-----------
Public strVariable as String
Sub CallingProcedure()
Dim procVar1 as string
...
strVariable=""
frmUserForm14.Show vbModeless
cellLinkI = strVariable
...
End Sub
------------------------------
----code in frmUserForm14-----
(no declarations)
Public butOkay_Click()
Dim strFormVar as String
strFormVar=""
If strFormVar="X" Then
strVariable=strFormVar
Else
strVariable="Z"
End If
Unload Me
End Sub
------------------------------
When this code is run, the value of strVariable after the call is "".
Another way to do this might be to call the form with the variable
"ByRef" so that it is returned to the variable in the calling
procedure.
Maybe the problem is that the Form is not a Module.
Thank you.
John Wirt