Advertisement
Advertisement
| 04.16.2008 at 10:57AM PDT, ID: 23328174 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: |
Sub GetFreeSpace()
Dim iSpc, strComputer, objWMIService
Dim fso, fsHandle, MyShell, LogFileName, colItems, objItem
Dim rngCell As Range, lngCol As Long, rngOut As Range
For Each rngCell In Intersect(ActiveSheet.UsedRange, ActiveSheet.Columns("A"))
If rngCell.Value <> "" Then
strComputer = rngCell.Value
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
("Select * From Win32_LogicalDisk Where DriveType = 3")
lngCol = 1
For Each objItem In colItems
'Retrieve free space & convert from uint64
iSpc = CDbl(objItem.FreeSpace)
iSpc = iSpc / 1024
Set rngOut = Cells(rngCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1)
rngOut.Value = objItem.Caption
rngOut.Offset(0, 1).Value = Format(iSpc, "#,##0 ""KB""")
lngCol = lngCol + 1
Next objItem
End If
Next rngCell
End Sub
|