"Chip Pearson" <(E-Mail Removed)> wrote:
> When a $ character is at the end of a string function
> such as Chr, it tells VBA to use the String, as
> opposed to the Variant, version of the function.
I did not know there were two versions and they can co-exist. The Chr
Function Help page describes only a function that returns type String. Live
and learn!
I presume the ability to have two versions of functions(different types) is
limited to intrinsic VBA functions. I get an error when I try to create a
Variant and String function with the same name in the same module. When I
create Public Variant and String functions with the same name in different
module, Call funcName$ calls whichever function is in the same module, even
it is Variant function(!); but x = funcName$ raises a compiler error when
called in the module with the Variant function declaration. Call funcName$
also raises a compiler error when called from a module with no function
declaration of the name.
----- original message -----
"Chip Pearson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> When a $ character is at the end of a string function such as Chr, it
> tells VBA to use the String, as opposed to the Variant, version of
> the function. In most respects, it is irrrelevant whether you use the
> $ version of the function.
>
> Cordially,
> Chip Pearson
> Microsoft Most Valuable Professional,
> Excel, 1998 - 2010
> Pearson Software Consulting, LLC
> www.cpearson.com
>
>
>
>
>
> On Sat, 3 Apr 2010 15:41:01 -0700, kylefoley2000
> <(E-Mail Removed)> wrote:
>
>>what does chr$ mean in this code
>>
>>Sub rick()
>>Dim strabc(1 To 26) As String
>>Dim i As Integer
>>Dim strprompt As String
>>For i = 1 To 26
>> strabc(i) = Chr$(i + 64)
>>Next i
>>strprompt = "hey:" & vbCrLf
>>For i = 1 To 26
>> strprompt = strprompt & strabc(i)
>>Next i
>>MsgBox strprompt
>>
>>
>>End Sub