D
Dave
I need to call a sub procedure and have it assign a value to a variable that
will be available throughout a module.
I can call a function and have it return a value to the calling procedure.
But I cannot call a procedure from another procedure, have it change the
value of a variable and then be able to reference this variable in other
procedures within the module.
For example, in the code below, the value of "bln" is true in the called
proc but in the calling proc it is empty.
What don't I understand?
Dave
-------------------
'Private bln As Boolean
Public bln As Boolean
Private Sub Command41_Click()
IsItEven (txtX)
Debug.Print "Calling Proc = " & bln
End Sub
'Private Sub IsItEven(ByRef x As Integer)
'Private Sub IsItEven(ByVal x As Integer)
Private Sub IsItEven(x As Integer)
If x Mod 2 = 0 Then
bln = True
Else
bln = False
End If
Debug.Print "Called Proc = " & bln
End Sub
will be available throughout a module.
I can call a function and have it return a value to the calling procedure.
But I cannot call a procedure from another procedure, have it change the
value of a variable and then be able to reference this variable in other
procedures within the module.
For example, in the code below, the value of "bln" is true in the called
proc but in the calling proc it is empty.
What don't I understand?
Dave
-------------------
'Private bln As Boolean
Public bln As Boolean
Private Sub Command41_Click()
IsItEven (txtX)
Debug.Print "Calling Proc = " & bln
End Sub
'Private Sub IsItEven(ByRef x As Integer)
'Private Sub IsItEven(ByVal x As Integer)
Private Sub IsItEven(x As Integer)
If x Mod 2 = 0 Then
bln = True
Else
bln = False
End If
Debug.Print "Called Proc = " & bln
End Sub