How to access to a particular file in  a drive?

Posted on 2003-02-25
Medium Priority
Last Modified: 2010-05-01
I'd like to know how to access to a particular file in a drive.I know I'd have to make use of the drivelistbox and dirlistbox.But how to link it altogether to access to a particular file?
Right now,i can only access to C:
Question by:VivienW
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

adp1970 earned 70 total points
ID: 8015897
If I understand correctly, you want to develop your own open/save dialog box kind of thing.

You require drivelist, dirlist, filelist.

Add the three controls. In change event of dir and drivelists, add the codes,

Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

Private Sub Drive1_Change()
    Dir1.Path = Drive1.Drive
    File1.Path = Dir1.Path
End Sub


dir1.path & "\" & file1.filename

to retrieve the filename with full path.

Author Comment

ID: 8021659
Yes,thank you adp1970.
Having done that, I want to access to a certain file from the directory and file list and use the contents of that file(say..a .txt file in this case) in my application. I would like to assign variables to some of the contents in the txt file.
How do I do that??

Expert Comment

ID: 8046390
Sorry, your question is not clear to me. Do you want to restrict the type of file in the filelistbox? If so, Use file1.pattern = "*.txt"
or whatever you want eg. *.*, *.bat etc.

But you are saying you want to use the contents of that file, then you have to open the file, read from the file using Input statement or newer FSO model.


Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question