How can we return a value from User Defined Function ?
For Eg. we have 2 functions. In Fun1 i am getting 2 values
(a,b) and i am addding those 2 and storing in to another var
(c). Now i want to pass that var(c) to another function
(fun2). What will be the script?
Answer Posted / chivukula.kumar
'Try this Code in Only MS-Excel
'After opened should be press Alt+F11
'select and double click the ThisWoorkbook in VBA Project
leftside of application
' paste this code in that
Private Sub Workbook_Open()
Call add(1000, 20000, c)
Call subb(c, 20000)
End Sub
'Creation of Fun1 and Fun2(add and subb)
Function add(a, b, c)
a = a + b
c = a
MsgBox c
End Function
Function subb(c, d)
sb = c - d
MsgBox sb
End Function
| Is This Answer Correct ? | 10 Yes | 3 No |
Post New Answer View All Answers
what is diff between static and dynaic arrys?
HOw we can apply web service checkpoint in QTP 9.5? I tried it out with net connection also. But not getting success.
What are the disadvantages of vbscript?
How can you destroy an object in vbscript?
Set srchobj=Description.Create() srchobj("type").value="text" srchobj("name").value="q" srchobj("html tag").value="input" browser("micclass:=google").Page("micclass:=google").webedit (srchobj).Set "qtp" what's wrong in my code pls tell me ? the above code working fine and i got my result pass,now i am trying to run the program it shows general run time error why?pls help me i am in learning stage ?
What are the 2 ways to pass a value to the function?
how to answer "TELL ME ABOUT UR SELF" as exp.person. whr to start and whr to stop. can anyone tel me
How are comments handled in the vbscript language?
What is select case statement?
Explain the extension .hta?
How to open a file. What is the perpose of true and false mode there?
What if you do not specify anything when you call a procedure?
Explain about constants in vb script?
Why is it recommended to close the database connection every time after the work is completed?
What is the use of option explicit in vbscript?