vba:变量前的井号(#)是什么意思

标签 vba excel

我正在编写代码来从文本文件中读取行,我遇到了这个方法:

Dim FileNum As Integer
Dim DataLine As String

FileNum = FreeFile()
Open "Filename" For Input As #FileNum

我明白当 #放在变量后面,它表示它是 double ,但是当它放在变量前面时,它意味着什么,如Open "Filename" For Input As #FileNum

最佳答案

#(表示“数字”)自古以来就存在。 VB6只支持它。它在执行方面没有任何作用。它用于提高可读性并使语言更加自然。大声说出来:

Open "1.txt" For Input As 1

对比

Open "1.txt" For Input As #1

引用:- What does a hash do to a variable in VB?

关于vba:变量前的井号(#)是什么意思,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42344454/

相关文章:

Excel VBA 宏 - 如何以最有效的方式组合 2 张工作表

vba - Excel VBA "Out of Memory"调试技巧

java.io.IOException : Failed to read zip entry source 异常

regex - 如何在 VBA 中使用 RegExp 隔离空格(\s 与\p{Zs})?

ruby - 如何从 Ruby 运行 Excel 宏?

VBA 锁定了我的工作表

Excel VBA : Which OLE/OCX control to use to display a chart in a form?

python - Microsoft Excel 2010 和 Python 中的 protected View

php - 用于 Excel 的 HTML 表格 - PHP

excel - 多列与多列查找