LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35
Default the '$' in right$()

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
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"