AllExperts > Experts 
Search      

Visual Basic

Volunteer
Answers to thousands of questions
 Home · More Questions · Answer Library  · Encyclopedia ·
More Visual Basic Answers
Question Library

Ask a question about Visual Basic
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Ravindra
Expertise
visual basic application programming from design to access information, sql, engineering and commercial applications. access databases, excel. Optional: 1) if you want me to spend quality time and do special work, i expect to be paid a reasonable price for my time. 2) if you are pleased with my reply you could consider a donation of 1$. 3) you can visit my website http://ravindra.coolpage.biz (under constrn)

Experience

Past/Present clients
project work for a Norway company, and a Canadian company completed. Freelance Project work and Teaching
teaching vb

 
   

You are here:  Experts > Computing/Technology > Basic > Visual Basic > Search for a FIle on a Drive in VB6

Topic: Visual Basic



Expert: Ravindra
Date: 7/23/2008
Subject: Search for a FIle on a Drive in VB6

Question
Hello,
I am using VB6. I have been having some trouble determining the proper search command to search for a file name on a drive and return the entire file path if found.

Thanks,
DuBois

Answer
'put a check  mark on PRoject_references _ Microsoft Scripting runtime


Public Function FileExists(sFullPath As String) As Boolean
   Dim oFile As New Scripting.FileSystemObject
   FileExists = oFile.FileExists(sFullPath)
End Function

use
If FileExists("C:\vb\yourfilename.vbp") = True Then
msgbox ("File Exists")
else
msgbox("File Does Not exist")
end if

' this is a sample code and you need to make changes as needed


Ravindra M.G.

Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.