PC Review


Reply
Thread Tools Rate Thread

how to check if the file exists or not

 
 
Mili
Guest
Posts: n/a
 
      6th Nov 2003
Hi,

I would like to display as true or false depending upon
the existance of a specified file in the directory.

if yes display true
or display false.

I am using office 2000
i am using following code :
'*******************************************************
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile("c:\test\file1.txt")
s = f.DateCreated
MsgBox " File Name := " & f.Name & " File Created on := "
& s & "Header File := " & headerTemplate & " File
Exists := " & fs.DriveExists(headerTemplate)
'*******************************************************

Thanks

Regards

Mili


 
Reply With Quote
 
 
 
 
Harald Staff
Guest
Posts: n/a
 
      6th Nov 2003
Hi Mili

Sub test()
MsgBox FileXists("c:\test\file1.txt")
End Sub

Function FileXists(fName As String) As Boolean
On Error Resume Next
FileXists = Len(Dir(fName))
End Function

--
HTH. Best wishes Harald
Followup to newsgroup only please

"Mili" <(E-Mail Removed)> skrev i melding
news:09a701c3a456$5302eff0$(E-Mail Removed)...
> Hi,
>
> I would like to display as true or false depending upon
> the existance of a specified file in the directory.
>
> if yes display true
> or display false.
>
> I am using office 2000
> i am using following code :
> '*******************************************************
> Dim fs, f, s
> Set fs = CreateObject("Scripting.FileSystemObject")
> Set f = fs.GetFile("c:\test\file1.txt")
> s = f.DateCreated
> MsgBox " File Name := " & f.Name & " File Created on := "
> & s & "Header File := " & headerTemplate & " File
> Exists := " & fs.DriveExists(headerTemplate)
> '*******************************************************
>
> Thanks
>
> Regards
>
> Mili
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
check file exists iccsi Microsoft Access Form Coding 3 6th Feb 2009 05:02 PM
Check if file exists WembleyBear Microsoft Excel Programming 3 19th May 2008 04:39 PM
Check if file exists... =?Utf-8?B?YWJkcnVtcw==?= Microsoft Excel Programming 3 13th Jul 2007 05:30 AM
Check if File exists Ricardo Luceac Microsoft C# .NET 10 23rd Jan 2006 02:41 PM
Check if file exists Newbie Microsoft Access Form Coding 3 4th Nov 2003 05:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:29 AM.