Hey,
I've adapted this WMI script from the Script Center on Microsoft's site. the code itself works fine, but this picks up all drives including A: and E: (my floppy and CDROM), as there is not always a disk in these drives it comes up with the error, Run Time Error '71' Disk Not Ready, so I added and Error Handler, Now It picks up the error for the A: and misses the Drive out if blank, but for the E: it still comes up with the Error, the Error Handler doesn't even acknowledge that there is an error. I can not figure out for the life of me what the problem is. I have even made the error handler non specific, so it will miss out any drive that causes the code to error, but still it didn't pick the error up, Anyone have any ideas?
Thanks in advance for any help
Sam
On Error GoTo ErrorHandler
Set objFSO = CreateObject("Scripting.FileSystemObject"
Set colDrives = objFSO.Drives
For Each objDrive In colDrives
Me.List2.RowSource = Me.List2.RowSource & ";;Drive letter: " & objDrive.DriveLetter
Me.List2.RowSource = Me.List2.RowSource & ";Free space: " & objDrive.FreeSpace
Me.List2.RowSource = Me.List2.RowSource & ";Total size: " & objDrive.TotalSize
Miss:
Next
Exit Sub
ErrorHandler:
If Err.Number = 71 Then
GoTo Miss
End If
"You couldn't fool your mother on the foolingest day of your life if you had an electrified fooling machine." - Homer
I've adapted this WMI script from the Script Center on Microsoft's site. the code itself works fine, but this picks up all drives including A: and E: (my floppy and CDROM), as there is not always a disk in these drives it comes up with the error, Run Time Error '71' Disk Not Ready, so I added and Error Handler, Now It picks up the error for the A: and misses the Drive out if blank, but for the E: it still comes up with the Error, the Error Handler doesn't even acknowledge that there is an error. I can not figure out for the life of me what the problem is. I have even made the error handler non specific, so it will miss out any drive that causes the code to error, but still it didn't pick the error up, Anyone have any ideas?
Thanks in advance for any help
Sam
On Error GoTo ErrorHandler
Set objFSO = CreateObject("Scripting.FileSystemObject"
Set colDrives = objFSO.Drives
For Each objDrive In colDrives
Me.List2.RowSource = Me.List2.RowSource & ";;Drive letter: " & objDrive.DriveLetter
Me.List2.RowSource = Me.List2.RowSource & ";Free space: " & objDrive.FreeSpace
Me.List2.RowSource = Me.List2.RowSource & ";Total size: " & objDrive.TotalSize
Miss:
Next
Exit Sub
ErrorHandler:
If Err.Number = 71 Then
GoTo Miss
End If
"You couldn't fool your mother on the foolingest day of your life if you had an electrified fooling machine." - Homer