トップページ(目次)

455.PCのすべてのドライブ名を取得する

<実行前後>
 → 
Sub PCのすべてのドライブ名を取得する()

    Set WIN = GetObject("winmgmts:\\" & "." & "\root\cimv2")
    Set DISK = WIN.ExecQuery("SELECT * FROM Win32_LogicalDisk", , 48)
    
    For Each ドライブ In DISK
    
        行 = 行 + 1
        
        Range("A" & 行) = ドライブ.Name
    
    Next

End Sub

Copyright © 2021 https://excel3000.web.fc2.com/ All Rights Reserved.
    inserted by FC2 system