thanks norie.
i was trying to find documentation on that earlier, with no success
but with the search 'right variant string dollar', i found the
following:
http://msdn.microsoft.com/en-us/libr...ffice.10).aspx
out of interest, how did you find out about this, seeing as it isn't
in the inbuilt excel help :) (well, i was unable to find it)
On 22 June, 15:36, norie wrote:
'Right' returns a Variant/String wheres 'Right$' returns a String.
Apart from that they are used in the same way.
The only circumstance I can think of where the 2nd might be needed is
if you needed to ensure
you returned a String.
On Jun 22, 3:18*pm, brzak wrote:
this is hopefully really simple
i came across a line in a short sub that i don't quite full
understand. The line in question is:
* * If Right$(fldr, 1) < "\" Then fldr = fldr & "\"
why is it 'Right$' instead of simply 'Right' ?
I haven't seen any difference in behaviour for what i've been using it
on..
Is there an instance when it would be different?
Thanks
Brz
Code (http://www.ozgrid.com/forum/showthread.php?t=71409) is below:
Sub testit()
* * myvar = FileList("C:\")
* * For i = LBound(myvar) To UBound(myvar)
* * * * Debug.Print myvar(i)
* * Next
End Sub
*Function FileList(fldr As String, Optional fltr As String = "*.*") As
Variant
* * Dim sTemp As String, sHldr As String
* * If Right$(fldr, 1) < "\" Then fldr = fldr & "\"
* * sTemp = Dir(fldr & fltr)
* * If sTemp = "" Then
* * * * FileList = *Split("No files found", "|") 'ensures an *array is
returned
* * * * Exit Function
* * End If
* * Do
* * * * sHldr = Dir
* * * * If sHldr = "" Then Exit Do
* * * * sTemp = sTemp & "|" & sHldr
* * *Loop
* * FileList = Split(sTemp, "|")
End Function