Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting if an external hard drive is connected 1

Status
Not open for further replies.

VickyC

Technical User
Sep 25, 2010
206
CA
I found a useful function on-line that I use in my application.
Public Function ListFiles(strPath As String, Optional strFileSpec As String, Optional bIncludeSubfolders As Boolean)

A typical usage is...
Call ListFiles("E:\ARCHIVE_130822\CompletedTables__ARCHIVE", "Group_?_WorkCode_?????.mdb", True)

The function works perfectly (there's no need to list the actual function here). In the line above, E is an external hard drive.
My problem is that if this external hard drive is NOT connected, I get no error. What code would give me a msgbox if the drive is not connected?

thanks in advance
 
I just realized that Allen Browne's FileExists function does the job.
 
Great when you solve your own problems...
Done it before myself.... post a question, and then lightbulb goes on...
:)



Steve Medvid
IT Consultant & Web Master
 
Very often, especially at the beginning of programming, when you voice / say out loud your question and / or explain in plain English (or any other language of your choice) your problem, 99% of times you will come to your own solution. That’s why it is handy to have a toddler (between 1 and 3 years old) available when you program. Just explain to the baby your trouble, and in no time you get the solution. :)

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top