一个Module,便于查找文件,dir函数不适用的情况下,此函数比较便捷。$ f' ?7 P7 e9 ^2 t( N9 P8 q
拿的M$的eg,修改了一下,效果还可以。支持网络上的文件。1 R$ _8 X$ q' S; B, J1 T% \9 P
- '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
复制代码 |