-
1
- #1
Can someone help me, basically im trying to write a macro that will determine the drive information (particularly the amount of storage space left on hard disks) on each computer in our LAN.
This is the code I have written so far:
Sub Storage_Properties()
Dim FileSys, Drv
Dim Row As Integer
Set FileSys = CreateObject("Scripting.FileSystemObject"
Row = 1
On Error Resume Next
For Each Drv In FileSys.Drives
Row = Row + 1
Cells(Row, 2) = Drv.Driveletter
Cells(Row, 3) = Drv.IsReady
Select Case Drv.DriveType
Case 0: Cells(Row, 4) = "Unknown"
Case 1: Cells(Row, 4) = "Removable"
Case 2: Cells(Row, 4) = "Fixed"
Case 3: Cells(Row, 4) = "Network"
Case 4: Cells(Row, 4) = "CD-ROM"
Case 5: Cells(Row, 4) = "RAM Disk"
End Select
Cells(Row, 5) = Drv.VolumeName
Cells(Row, 6) = Drv.TotalSize
Cells(Row, 7) = Drv.AvailableSpace
Next Drv 'Moves on to next drive
End Sub
This obtains the information i want, but only for the current computer, does anyone know how i can move to a new network path and scan another computer on the LAN (if that is what i need to do)?
This is the code I have written so far:
Sub Storage_Properties()
Dim FileSys, Drv
Dim Row As Integer
Set FileSys = CreateObject("Scripting.FileSystemObject"
Row = 1
On Error Resume Next
For Each Drv In FileSys.Drives
Row = Row + 1
Cells(Row, 2) = Drv.Driveletter
Cells(Row, 3) = Drv.IsReady
Select Case Drv.DriveType
Case 0: Cells(Row, 4) = "Unknown"
Case 1: Cells(Row, 4) = "Removable"
Case 2: Cells(Row, 4) = "Fixed"
Case 3: Cells(Row, 4) = "Network"
Case 4: Cells(Row, 4) = "CD-ROM"
Case 5: Cells(Row, 4) = "RAM Disk"
End Select
Cells(Row, 5) = Drv.VolumeName
Cells(Row, 6) = Drv.TotalSize
Cells(Row, 7) = Drv.AvailableSpace
Next Drv 'Moves on to next drive
End Sub
This obtains the information i want, but only for the current computer, does anyone know how i can move to a new network path and scan another computer on the LAN (if that is what i need to do)?