Public Sub EdgeColor_Click()
Dim intInFile As Integer
intInFile = FreeFile
Open "c:\picturename.csv" For Output As #intFileNo
Print #intFileNo, "test"
Close #intFileNo
End Sub
这是我的代码,我收到运行时错误 52 'bad file name or number'。我尝试过作为输入并使文件存在,但我得到了同样的错误。
这是 Proficy iFix 图形中的 VBA,我终生无法弄清楚我做错了什么。
最佳答案
你混淆了 intInFile
和 intFileNo
。
如果您不使用 option explicit
命令,则可能将 intFileNo
简单地设置为零,这可能会解释无效数字。
这个小命令出现在我的 VB/VBA 文件每个的顶部,因为我之前已经被这个烧伤了很多次了。
关于VBA写入文本文件: Run-time error 52 'bad file name or number' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6301495/