Ok,
1. This is not VBScript it is VB.
2. You are trying to call a function called Split_Example which does not exist. Your VBScript code has a function called Split_Example1. Note the 1 at the end.
3. Not sure why you have that semicolon delimited list of text after the call as your subroutine does not take any parameters. Plus the Split function's default is to use the space character and you haven't overridden that. The value you are passing Split is already defined inside the function.
4. Your VBEval statement is trying to evaluate a variable which is defined inside a subroutine. You can't do that. You can only evaluate global scope variables.
5. You cannot pass a VBScript array variable into a MacroScript array variable, but you CAN evaluate an array _element_.
So, this is what I THINK you wanted:
Code: Select all
VBSTART
'global variable we can access later ...
Dim MyResult
Sub Split_Example1()
Dim MyText
MyText = "My Name is Excel VBA"
MyResult = Split(MyText)
End Sub
VBEND
VBRun>Split_Example1
//access the second word (index 1)
VBEval>MyResult(1),val
mdl>val