一个Module,便于查找文件,dir函数不适用的情况下,此函数比较便捷。" k" I$ `% I7 c+ x; t$ ~8 W; B
拿的M$的eg,修改了一下,效果还可以。支持网络上的文件。1 s3 j" t+ n' a7 p7 P2 z
- 'by Firendless at 090319
- 'www.promiseforever.com
- Option Explicit
- Private Declare Function OpenFile _
- Lib "kernel32" (ByVal lpFileName As String, _
- lpReOpenBuff As FirFile, _
- ByVal wStyle As Long) As Long
-
- Private Type FirFile
-
- cBytes As Byte
- fFixedDisk As Byte
- nErrCode As Integer
- Reserved1 As Integer
- Reserved2 As Integer
- szPathName(128) As Byte
-
- End Type
-
- Public Function CheckFileExist(strSearchFile As String) As Boolean
- If strSearchFile = "" Then
-
- CheckFileExist = False
- Exit Function
-
- End If
-
- Dim lngResult As Long
- Dim strFileBuff As FirFile
-
- lngResult = OpenFile(strSearchFile, strFileBuff, &H4000)
-
- If lngResult = -1 Then
-
- CheckFileExist = False
- Exit Function
-
- Else
-
- CheckFileExist = True
- Exit Function
-
- End If
-
- End Function
复制代码 |