Copy the routine (below) into a module and run it. The results will be
printed to the immediate window using Debug.Print
The result of Split is returned as an array. If you know how many elements
are in the array (UBound - LBound) then you can address whichever one you
want. In the example, to capture the third element to a variable called
CapVal, you would use:
CapVal = y(2)
'' *********************************************************
'' Purpose : Using "Split"
'' Written : 21-Feb-2004 by Andy Wiggins - Byg Software Ltd
''
Sub UsingSplit()
Dim x
Dim y
Dim z
Dim c
x = "c:\temp\aaa\bill.xls"
y = Split(x, "\")
z = UBound(y) - LBound(y)
For c = LBound(y) To UBound(y)
Debug.Print y(c)
Next
End Sub
--
Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"