I need to know whether a file with a certain name exists on a C drive and use the following function :<br>
<br>
Type WIN32_FIND_DATA ' 318 Bytes<br>
dwFileAttributes As Long<br>
nFileSizeHigh As Long<br>
nFileSizeLow As Long<br>
dwReserved¯ As Long<br>
dwReserved1 As Long<br>
cFileName As String<br>
cAlternate As String<br>
End Type<br>
<br>
Public lpFindFileData As WIN32_FIND_DATA<br>
Private A As Long, FileToFind As String<br>
<br>
Declare Function FindFirstFile& Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA)<br>
<br>
Public Sub FindFile()<br>
Dim FileFound As String<br>
FileToFind = "frmFatal.frm"<br>
A = FindFirstFile(FileToFind, lpFindFileData)<br>
FileFound = lpFindFileData.cFileName<br>
End Sub<br>
<br>
However I do not get satisfactory results. Am I using the function wrongly? Can somebody please help.<br>
Thanks<br>
PK<br>
<br>
<br>
Type WIN32_FIND_DATA ' 318 Bytes<br>
dwFileAttributes As Long<br>
nFileSizeHigh As Long<br>
nFileSizeLow As Long<br>
dwReserved¯ As Long<br>
dwReserved1 As Long<br>
cFileName As String<br>
cAlternate As String<br>
End Type<br>
<br>
Public lpFindFileData As WIN32_FIND_DATA<br>
Private A As Long, FileToFind As String<br>
<br>
Declare Function FindFirstFile& Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA)<br>
<br>
Public Sub FindFile()<br>
Dim FileFound As String<br>
FileToFind = "frmFatal.frm"<br>
A = FindFirstFile(FileToFind, lpFindFileData)<br>
FileFound = lpFindFileData.cFileName<br>
End Sub<br>
<br>
However I do not get satisfactory results. Am I using the function wrongly? Can somebody please help.<br>
Thanks<br>
PK<br>
<br>