Re: Replacement of FileExists method
From: Ken Halter (Ken_Halter_at_Use_Sparingly_Hotmail.com)
Date: 04/05/04
- Next message: Tim J: "Re: Can I shell to a .vbs or .wsh from vb6?"
- Previous message: Jane Ransom: "Re: how to measure programmer's job performance"
- In reply to: Syed Zeeshan Haider: "Replacement of FileExists method"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 5 Apr 2004 11:12:48 -0700
Here's the method I use....
'================
Option Explicit
Private Sub Form_Load()
If FileExists("C:\Temp\Test.txt") Then
MsgBox "It's there"
Else
MsgBox "It's not there"
End If
End Sub
Private Function FileExists(FileName As String) As Boolean
On Error Resume Next
If Len(FileName) > 0 Then
FileExists = ((GetAttr(FileName) And vbDirectory) = 0)
Err.Clear
End If
End Function
'================
Here's an "API Way" to do it... the API's probably more reliable for
hidden/system files (not sure, haven't tried)
An API 'FileExists' Routine
http://vbnet.mvps.org/index.html?code/fileapi/fileexists.htm
-- Ken Halter - MS-MVP-VB - http://www.vbsight.com Please keep all discussions in the groups.. "Syed Zeeshan Haider" <szhatforumsNoVirusesOrSpam@hotpop.com> wrote in message news:O%23DgeQzGEHA.3880@TK2MSFTNGP10.phx.gbl... > Hello Experts, > I have VB6EE on Win98SE. > > After realizing that FileSystemObject can disturb a sleeping dog known as > anti-virus, I have decided to abandon it completely. > But there is a method of FileSystemObject, which I use extensively and that > method is FileExists. > In search of a replacement of FileExists, I have come to following links: > > http://www.vb-helper.com/howto_check_file_exists_four_ways.html > > ...and... > > http://www.vb-helper.com/howto_see_if_file_exits_and_time_modified.html. > > But the ways written on these pages don't seem to me "solid". > > Are there any other ways to check if a file exists? > What do the non-FSO professionals do to find if a file exists or not? > > Thank you, > -- > Syed Zeeshan Haider. > http://szh.20m.com/ > http://gomusharrafgo.20m.com/ > > ----------------------------------- > Allah says to Mankind: > "Then which of the favours of your Lord will ye deny?" > >
- Next message: Tim J: "Re: Can I shell to a .vbs or .wsh from vb6?"
- Previous message: Jane Ransom: "Re: how to measure programmer's job performance"
- In reply to: Syed Zeeshan Haider: "Replacement of FileExists method"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|