When assigning the freefile return in VBA for excel to an integer, why do all future calls referencing this integer require a hashtag symbol before the variable?
For example:
Dim fileName As String, textData As String, textRow As String, fileNo As Integer
fileName = "C:\test.txt"
fileNo = FreeFile 'Get first free file number
textData ="Hello World!"
Open fileName For Output As #fileNo
Write #fileNo, textData
Close #fileNo
Why does the variable fileNo have to be reference as #fileNo? Is this another way of type declaration like I found here?
Use of symbol # (hash) in VBA Macro
Thanks!
Like many features which exist in VBA, such as GoSub...Return, While...Wend and optional line numbering, this syntax is a holdover from the various implementations of BASIC. Here is an example of it used in QBasic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With