http://www.mvps.org/dmcritchie/excel/dir_drives.txt From: "Tom Ogilvy" References: <9f07kk$575se$1@reader03.wxs.nl> Subject: Re: Size of Disk routine ? Date: Tue, 29 May 2001 14:02:38 -0400 Lines: 93 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: Newsgroups: microsoft.public.excel.programming NNTP-Posting-Host: wrmlv10.hqda.pentagon.mil 141.116.205.100 Path: tkmsftngp01!tkmsftngp05 Xref: tkmsftngp01 microsoft.public.excel.programming:199936 Create a reference to the Microsoft Scripting Runtime Library In Win 2K: C:\WINNT\System32\scrrun.dll then you can use this adaption of a MS KB Article: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q189667 HOWTO: List the Drives in a System Using the FileSystemObject Option Explicit Sub WorkWithDrives() Dim fso As FileSystemObject Dim fsoDrives As Drives Dim fsoDrive As Drive Dim sDrive As String Dim sDriveType As String Dim sDr As String Dim sSpec As String Set fso = New FileSystemObject Set fsoDrives = fso.Drives For Each fsoDrive In fsoDrives sDrive = "Drive " & fsoDrive.DriveLetter & ": " sDr = fsoDrive.DriveLetter Select Case fsoDrive.DriveType Case 0: sDriveType = "Unknown" Case 1: sDriveType = "Removable Drive" Case 2: sDriveType = "Fixed Disk" Case 3: sDriveType = "Remote Disk" Case 4: sDriveType = "CDROM Drive" Case 5: sDriveType = "RAM Disk" End Select MoreDetails fso, sDr, sSpec sDrive = sDrive & sDriveType & vbCrLf sDrive = sDrive & sSpec MsgBox sDrive Next Set fsoDrives = Nothing End Sub Sub MoreDetails(fso As FileSystemObject, sSelDrive As String, sSpec As String) Dim sDriveSpec As String Dim fsoDrive As Drive Set fsoDrive = fso.GetDrive(sSelDrive) With fsoDrive If .IsReady = True Then sDriveSpec = "Drive " & .DriveLetter & _ " Specifications" & vbLf sDriveSpec = sDriveSpec & "Free Space: " & _ .FreeSpace & " bytes" & vbLf sDriveSpec = sDriveSpec & "File System: " & _ .FileSystem & vbLf sDriveSpec = sDriveSpec & "Serial Number: " & _ .SerialNumber & vbLf sDriveSpec = sDriveSpec & "Total Size: " & _ .TotalSize & " bytes" & vbLf sDriveSpec = sDriveSpec & "Volume Name: " & _ .VolumeName sSpec = sDriveSpec Else sSpec = "Drive Not Ready" End If End With End Sub Regards, Tom Ogilvy ----- http://support.microsoft.com/default.aspx?scid=kb;en-us;Q225032 BUG: Drive Object Properties Are Incorrect on Large Drives (>2GB) http://support.microsoft.com/default.aspx?scid=kb;en-us;Q225144 HOWTO: Use GetDiskFreeSpaceEx to Retrieve Drive Information http://support.microsoft.com/default.aspx?scid=kb;en-us;Q153091 HOWTO: Find and View the Amount of Free Disk Space on a Drive ----- For those interested in the subject, I extracted the following "DiskSize" function: Martien Function DiskSize(DriveLetter As String) As Long Dim fso As FileSystemObject Set fso = New FileSystemObject DiskSize = fso.GetDrive(DriveLetter).TotalSize End Function "Martien Janssen" wrote in message news:9f07kk$575se$1@reader03.wxs.nl... > Hi, > > Is there a routine in VBA which gives the size of the C-drive (or other > disks), such as the DiskSize routine in Delphi ? > > Thanks, > > Martien > > > --------------- recursive list through directories -- Jake Maxx mon Oct 8, 2001 http://groups.google.com/groups?as_umsgid=eowoUaIUBHA.616@tkmsftngp07