Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call Sub Procedure From User Definded Function

Status
Not open for further replies.

BillBrosius

Programmer
Jan 9, 2003
33
US
Can you call a Sub Procedure from within a User Defined Function?

Function AddThis(var1,var2)
Call dothemath
End Function

Sub Procedure dothemath(f_var1,f_var2)
final_result = f_var1 + f_var2
Msgbox(final_reslut)
End Sub

Obviously this is a very simple example, but can it be done?

Thanks.

Bill
 

Yes, But ...
[tt]
Function AddThis(var1,var2)
Call dothemath(var1, var2)
End Function

Sub Procedure dothemath(f_var1,f_var2)
final_result = f_var1 + f_var2
Msgbox(final_reslut)
End Sub
[/tt]
In bold will need to be added for it to work and not throw an error.

Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top