passing parameter to run method at msscriptcontrol
-
in my project, i need a lot of different formulas so there is no standard formula and parameter the parameter will write on textbox, the formula in richtextbox example: formula 1 Parameter = test1, test2 (so there are 2 parameters) formula = test1 * test2 formula 2 Parameter = test1, test2, test3 formula = (test1 * test2) / test3 when i execute the formula i write strExec = "Dim formula" & vbCrLf strExec = strExec & "Sub Main (" & parameter & ")" & vbCrLf strExec = strExec & formula & vbCrLf strExec = strExec & "End Sub" & vbCrLf i use VBScript as the language the problem is, when the run method msScript.Run("Main", xxx) the parameter doesn't have a standard value, i may 2 or 3 parameter how to write in the xxx part? i have try using array, but it return error thanks
-
in my project, i need a lot of different formulas so there is no standard formula and parameter the parameter will write on textbox, the formula in richtextbox example: formula 1 Parameter = test1, test2 (so there are 2 parameters) formula = test1 * test2 formula 2 Parameter = test1, test2, test3 formula = (test1 * test2) / test3 when i execute the formula i write strExec = "Dim formula" & vbCrLf strExec = strExec & "Sub Main (" & parameter & ")" & vbCrLf strExec = strExec & formula & vbCrLf strExec = strExec & "End Sub" & vbCrLf i use VBScript as the language the problem is, when the run method msScript.Run("Main", xxx) the parameter doesn't have a standard value, i may 2 or 3 parameter how to write in the xxx part? i have try using array, but it return error thanks
-
aphei wrote:
how to write in the xxx part?
i have try using array, but it return errorLike this;
ref myArrayName
I are Troll :suss:
-
umm.. so, i just write msScript.Run("Main", ref strParam)? it returns error name ref is not declare comma, ')', or a valid expression continuation expected. do i need to imports anything? thanks
Hi,
aphei wrote:
msScript.Run("Main", ref strParam)
My apologies, accidentally posted c# syntax. Guess that would be "ByRef" in VB.NET, but I can't try it at the moment.
aphei wrote:
do i need to imports anything?
Only the reference to the scriptcontrol, and I think you already have that :)
I are Troll :suss: