Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to get list of subfolders, including shortcuts to folders?
The code below prints a list of subfolders in the specified folder.
However, it overlooks shortcuts to folders. How can I include shortcuts to folders in the list, but not files and shortcuts to files? I think I want to know: how can I find the attribute of the object that a shortcut ultimately links to? (By "ultimately links to", I mean: the non-shortcut object, if a shortcut links to a shortcut, if that is even possible in Win XP.) Shortcuts to folders and files have only the attribute vbArchive on Win XP, the same as normal files. (I suspect GetAttr returns zero if the object has been backed up.) Shortcuts are distinguishable from normal file by the extension ".lnk". But shortcuts to folders seem indistinguishable from shortcuts to files. Sub doit() Const topdir As String = "C:\Documents and Settings\foo\My Documents\bar\" Dim d As String, x As Long d = Dir(topdir, vbDirectory) While d < "" x = GetAttr(topdir & d) If InStr(d, ".lnk") Then stop 'debug If x And vbDirectory Then Debug.Print d d = Dir() Wend End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Please help to list folders and subfolders tree in Excel or Word | Excel Discussion (Misc queries) | |||
Opening files in folders and subfolders | Excel Discussion (Misc queries) | |||
linking Outlook email folders/subfolders to excell spreadsheets | Excel Worksheet Functions | |||
Map/List of folders, subfolders & files | Excel Programming | |||
Creating folders and subfolders from excel file list | Excel Discussion (Misc queries) |