http://blog.9cbs.net/vbdn/archive/2005/03/27/331975.aspx
Private Sub Command1_Click () Dim Shellapp, Opanel, FolderItem1, FolderItem2, OIITEM SELLAPPP = CreateObject ("shell.Application") set opanel = shellapp.namespace (0)
SET folderitem2 = nothing for each folderitem1 in OPANEL.ITEMS if folderitem1.name = "My Computer" THEN SETFOLDERITEM2 = folderitem1.GetFolder: exit for end if debug.print folderitem1.name next
If FolderItem2 is nothing kilbox "can't find the project!" EXIT SUB END IF
Set Oitem = Nothing for Each Oitem in FolderItem2.Items Debug.print OIITEM.NAME NEXTEND SUB
The output is as follows:
Control Panel 3.5 Floppy Disk (A :) WINDOWS98 (D :) Local Disk (E :) Data Backup (f :) CD (G :)