how i can get all drive in my computer?
does anyone know how to get it??

Thanks.

Recommended Answers

All 3 Replies

yes, here it is the code, try it and let me know if it worked :

Dim AllDir
Private Sub Form_Load()
On Error Resume Next
For i = 65 To 90
x = Dir(Chr(i) & ":\", vbDirectory + vbHidden + vbSystem)

If Err = 52 Then
    Err.Clear
Else
    If x <> "" Then AllDir = AllDir & (Chr(i) & ":\")
      Err.Clear
End If

Next i
MsgBox AllDir
End Sub

Hope this helps...

commented: thank you very much. it was i looking for +1
commented: worked +1
commented: spontan uhuy +1

Hi,

One more Simple way:

Add a DriveListBox on the form and loop thru all the list items.. it lists all the drives

Regards
Veena

yes.. got it.
thank you all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.