VB6 中的 Dir 函数 - 错误 5
Dir function in VB6 - Error 5
我对 Dir
函数有疑问。
Private Sub InitFileElvt()
Dim fileName As String
Dim find As Boolean
Dim trouve As Boolean
trouve = False
fileName = Dir(THEORIQUE & "\" & LibPie & CftMot & _
Mid(NoPlan, 13, 1) & Mid(VERPIE, 1, 1) & "\") 'It works here
Do While fileName > "" And Not trouve
If IsElvtFile(fileName) Then
trouve = True
pathFileElvt = THEORIQUE & "\" & fileName
End If
fileName = Dir() 'An error here
Loop
If Not trouve Then
pathFileElvt = "empty"
End If
End Sub
Private Function IsElvtFile(ByVal fileName As String) As Boolean
Dim lengthDeb As Integer
lengthDeb = Len(LibPie) + Len(CftMot) + 1
IsElvtFile = Left(fileName, lengthDeb) = LibPie + CftMot + Mid(NoPlan, 13, 1) And _
Right(fileName, 4) = ".ELV"
End Function
第一次打电话给 Dir
从文件夹中给我一个文件。好的。但是第二个电话给我 Run-Time Error '5': Invalid Procedure Call or Argument
Dir
函数我缺少什么?显然,这就是它必须使用的方式。
当我处于调试模式时,在 Do While fileName > "" And Not trouve
行中,我在目录 returns 上查看下一个文件。执行此行后,我的手表显示错误。
Dir(otherPath)
还有其他手表...
我已删除它们,现在可以使用了
我对 Dir
函数有疑问。
Private Sub InitFileElvt()
Dim fileName As String
Dim find As Boolean
Dim trouve As Boolean
trouve = False
fileName = Dir(THEORIQUE & "\" & LibPie & CftMot & _
Mid(NoPlan, 13, 1) & Mid(VERPIE, 1, 1) & "\") 'It works here
Do While fileName > "" And Not trouve
If IsElvtFile(fileName) Then
trouve = True
pathFileElvt = THEORIQUE & "\" & fileName
End If
fileName = Dir() 'An error here
Loop
If Not trouve Then
pathFileElvt = "empty"
End If
End Sub
Private Function IsElvtFile(ByVal fileName As String) As Boolean
Dim lengthDeb As Integer
lengthDeb = Len(LibPie) + Len(CftMot) + 1
IsElvtFile = Left(fileName, lengthDeb) = LibPie + CftMot + Mid(NoPlan, 13, 1) And _
Right(fileName, 4) = ".ELV"
End Function
第一次打电话给 Dir
从文件夹中给我一个文件。好的。但是第二个电话给我 Run-Time Error '5': Invalid Procedure Call or Argument
Dir
函数我缺少什么?显然,这就是它必须使用的方式。
当我处于调试模式时,在 Do While fileName > "" And Not trouve
行中,我在目录 returns 上查看下一个文件。执行此行后,我的手表显示错误。
Dir(otherPath)
还有其他手表...
我已删除它们,现在可以使用了