The VB split command wrong

hi everyone, could any one help me.
i want to: when input a full path file name, the function could get the file name without path. codes shows below:
Option Explicit

Call Main()
Sub Main()
	Dim a, filename
	a = "C:\abcd.txt" 
	filename = fGetLast(a) 
End Sub

Function fGetLast(ByVal originalString)
	Dim tmps()
	Dim delimeter
	delimeter = "\" 
	tmps = Split(originalString, delimeter)
	fGetLast = tmps(UBound(tmps))
End Function

but codes could not run, seems Rhino could not understand the VB command “Split”, could any one help me on this? thank you very much.

Just remove the parentheses when defining tmps… Otherwise you are declaring it as a dynamic array, then you can’t assign the result of the split directly to it…

i.e. Dim tmps not Dim tmps()

HTH, --Mitch

You can also split a path string using a function like this:

– Dale