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

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

 
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 12:47 PM.

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"