Sabtu, 14 Agustus 2010

Check For a File

Public Function FileExist(asPath as string) as Boolean
If UCase(Dir(asPath))=Ucase(trimPath(asPath)) then
FileExist=true
Else

FileExist=False
End If
End Function

Public Function TrimPath(ByVal asPath as string) as string

if Len(asPath)=0 then Exit Function
Dim x as integer
Do

x=Instr(asPath,”\”)
if x=0 then Exit Do
asPath=Right(asPath,Len(asPath)-x)
Loop
TrimPath=asPath
End Function

Private sub command1_Click()
if fileExist(Text1.text) then
Label1=”YES”
else
Label1=”NO”
End if
End Sub

Private sub form_Load()
End sub

Tidak ada komentar:

Posting Komentar