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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

called sub and variable keeping 1

Status
Not open for further replies.

wvdba

IS-IT--Management
Jun 3, 2008
465
US
i have this code:
Code:
call called_sub
msgbox x 
wscript.quit 

sub called_sub
    x = x + 1 
end sub
my problem is that called_sub sets variable's value, but after the call, the calling statement can't recall that variable's value. is there any way to get around this?
thanks.
 
Why not using a function instead ?
Code:
Dim x
x = 1
x = called_sub(x)
MsgBox x 
WScript.Quit 

Function called_sub(theParm)
    called_sub = theParm + 1 
End Function

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
thanks PHV.
that works perfect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top