Display all drives

Submitted by:Tim Kelly

Date added:22 October, 2012

Category:Visual Basic

Visual Basic sample source code to display all drives

Tags: display drives

Code Snippet:

Display all drives

'display all drives on system
'place a combo box on the form

Private Sub Form_Load()
Dim objfso As Scripting.FileSystemObject
Dim objDrives As drives, objDrive As drive

Set objfso = CreateObject("Scripting.FileSystemObject")
Set objDrives = objfso.drives
For Each objDrive In objobjDrives
Combo1.AddItem objDrive.DriveLetter
Next

End Sub
 
 

Comments