Calling Sub / Called Sub

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Scenario..
I have two Subs: sub A and sub B. sub A calls sub B where sub B has functionality to determine a true or false. I want to pass a value (in this case a true or false back to the calling sub (sub A). How do I get it to do this. what does the code structurelook like

I've looked all through the online help but haven't found anything. Maybe I am looking under the wrong topic

-Warren R.
 
Public Function B( arg ) as Boolean
if arg > rnd() then
B = True
else
B = False
end if
End Function

in A

Public Sub A()
Dim bRes as Boolean

bRes = b(arg)

End Sub

WarrenR said:
Scenario...
I have two Subs: sub A and sub B. sub A calls sub B where sub B has
functionality to determine a true or false. I want to pass a value (in this
case a true or false back to the calling sub (sub A). How do I get it to do
this. what does the code structurelook like?
I've looked all through the online help but haven't found anything. Maybe
I am looking under the wrong topic.
 
Hi Warren
one way: Convert sub B to a function. e.g.
Sub a()
dim b as boolean
b = func_a()
msgbox b
end sub

Function func_a() as boolean
'some code
func_a = False
end function
 
Back
Top