怎样得到一个系统盘的全名 不是字符 是全名 如:本地磁盘(C:)?
怎样得到一个系统盘的全名 不是字符 是全名 如:本地磁盘(C:)?,怎样得到一个系统盘的全名,不是字符,是全名,如:本地磁盘(C:)?
Private Sub Command1_Click() Dim ShellApp, oPanel, FolderItem1, FolderItem2, oItem Set ShellApp = CreateObject("Shell.Application") Set oPanel = ShellApp.NameSpace(0)
Set FolderItem2 = Nothing For Each FolderItem1 In oPanel.Items If FolderItem1.Name = "我的电脑" Then Set FolderItem2 = FolderItem1.Getfolder: Exit For End If Debug.Print FolderItem1.Name Next
If FolderItem2 Is Nothing Then MsgBox "找不到项目!" Exit Sub End If
Set oItem = Nothing For Each oItem In FolderItem2.Items Debug.Print oItem.Name NextEnd Sub
输出结果如下:
控制面板3.5 软盘 (A:)WINDOWS98 (C:)程序 (D:)本地磁盘 (E:)数据备份 (F:)光盘 (G:)