-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModFile.bas
More file actions
34 lines (24 loc) · 836 Bytes
/
Copy pathModFile.bas
File metadata and controls
34 lines (24 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Attribute VB_Name = "ModFile"
Option Explicit
Private Const OF_EXIST As Long = &H4000
Private Const OFS_MAXPATHNAME As Long = 128
Private Const HFILE_ERROR As Long = -1
Private Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName(OFS_MAXPATHNAME) As Byte
End Type
Private Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, _
lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Public Function FileExists(ByVal sFileName As String) As Boolean
Dim lRetVal As Long
Dim OfSt As OFSTRUCT
Dim RetVal As Boolean
RetVal = False
lRetVal = OpenFile(sFileName, OfSt, OF_EXIST)
If (lRetVal <> HFILE_ERROR) Then RetVal = True
FileExists = RetVal
End Function