There are a number of ways to do this...here is one.
<pre><FONT COLOR="#007F00">'// Requires DLL version shell32.dll version 4.71 or later</FONT>
<FONT COLOR="#007F00">'// Operating systems</FONT>
<FONT COLOR="#007F00">'// Win2000, WinNT 4.0 with Internet Explorer 4.0, Win98, Win95 with Internet Explorer 4.0</FONT>
<FONT COLOR="#007F00">'Item Identifiers and Identifier Lists</FONT>
<FONT COLOR="#007F00">'The Shell uses object identifiers within the Shell's namespace.</FONT>
<FONT COLOR="#007F00">'All objects visible in the Shell (files, directories, servers, workgroups, and so on)</FONT>
<FONT COLOR="#007F00">'have unique identifiers among the objects within their parent folder.</FONT>
<FONT COLOR="#007F00">'These identifiers are called item identifiers, and they have the ****EMID data type</FONT>
<FONT COLOR="#007F00">'as defined in the Shtypes.h header file. An item identifier is a variable-length byte</FONT>
<FONT COLOR="#007F00">'stream that contains information that identifies an object within a folder.</FONT>
<FONT COLOR="#007F00">'Only the creator of an item identifier knows the content and format of the identifier.</FONT>
<FONT COLOR="#007F00">'The only part of an item identifier that the Shell uses is the first two bytes,</FONT>
<FONT COLOR="#007F00">'which specify the size of the identifier.</FONT>
<FONT COLOR="#007F00">'Each parent folder has its own item identifier that identifies it within its own parent folder.</FONT>
<FONT COLOR="#007F00">'Thus, any Shell object can be uniquely identified by a list of item identifiers.</FONT>
<FONT COLOR="#007F00">'A parent folder keeps a list of identifiers for the items it contains.</FONT>
<FONT COLOR="#007F00">'The list has the ITEMIDLIST data type. Item identifier lists are allocated by the Shell</FONT>
<FONT COLOR="#007F00">'and may be passed across Shell interfaces, such as IShellFolder. It is important to remember</FONT>
<FONT COLOR="#007F00">'that each identifier in an item identifier list is only meaningful within the context of its parent folder.</FONT>
<FONT COLOR="#007F00">'An application can set a shortcut's item identifier list by using the SetIDList method.</FONT>
<FONT COLOR="#007F00">'This method is useful when setting a shortcut to an object that is not a file, such as</FONT>
<FONT COLOR="#007F00">'a printer or disk drive. An application can retrieve a shortcut's item identifier list</FONT>
<FONT COLOR="#007F00">'by using the GetIDList method.</FONT>
<FONT COLOR="#007F00">'What is a PIDL? Why not just use file system paths?</FONT>
<FONT COLOR="#007F00">'A PIDL (Program ID list) is a way of identifying any namespace object.</FONT>
<FONT COLOR="#007F00">'You can also use paths to identify namespace objects, but only if they are part of</FONT>
<FONT COLOR="#007F00">'the file system. <FONT COLOR="#00007F">With</FONT> namespace objects that are not part of the file system, you must use PIDLs.</FONT>
<FONT COLOR="#00007F">Sub</FONT> BrowseForFolderShell()
<FONT COLOR="#00007F">Dim</FONT> objShell <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>
<FONT COLOR="#00007F">Dim</FONT> objFolder <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">Object</FONT>
<FONT COLOR="#00007F">Dim</FONT> strFolderFullPath <FONT COLOR="#00007F">As</FONT> <FONT COLOR="#00007F">String</FONT>
<FONT COLOR="#00007F">Set</FONT> objShell = CreateObject("Shell.Application")
<FONT COLOR="#007F00">'oFolder = Shell.BrowseForFolder(Hwnd, sTitle, iOptions [, vRootFolder])</FONT>
<FONT COLOR="#00007F">Set</FONT> objFolder = objShell.BrowseForFolder(0, "Please select a folder", 0, "C:\") <FONT COLOR="#007F00">'SpecFolders.CSIDL_FAVORITES</FONT>
<FONT COLOR="#00007F">If</FONT> (Not objFolder <FONT COLOR="#00007F">Is</FONT> <FONT COLOR="#00007F">Nothing</FONT>) <FONT COLOR="#00007F">Then</FONT>
<FONT COLOR="#007F00">'// NB: <FONT COLOR="#00007F">If</FONT> SpecFolder= 0 = Desktop then ....</FONT>
<FONT COLOR="#00007F">On</FONT> <FONT COLOR="#00007F">Error</FONT> <FONT COLOR="#00007F">Resume</FONT> <FONT COLOR="#00007F">Next</FONT>
<FONT COLOR="#00007F">If</FONT> IsError(objFolder.Items.Item.path) <FONT COLOR="#00007F">Then</FONT> strFolderFullPath = <FONT COLOR="#00007F">CStr</FONT>(objFolder): <FONT COLOR="#00007F">GoTo</FONT> Here
<FONT COLOR="#00007F">On</FONT> <FONT COLOR="#00007F">Error</FONT> <FONT COLOR="#00007F">GoTo</FONT> 0
<FONT COLOR="#007F00">'// <FONT COLOR="#00007F">Is</FONT> it the Root Dir?...if so change</FONT>
<FONT COLOR="#00007F">If</FONT> Len(objFolder.Items.Item.path) > 3 <FONT COLOR="#00007F">Then</FONT>
strFolderFullPath = objFolder.Items.Item.path & Application.PathSeparator
<FONT COLOR="#00007F">Else</FONT>
strFolderFullPath = objFolder.Items.Item.path
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">If</FONT>
<FONT COLOR="#00007F">Else</FONT>
MsgBox "User cancelled": <FONT COLOR="#00007F">End</FONT>
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">If</FONT>
Here:
MsgBox "You selected:= " & strFolderFullPath, vbInformation, "ObjectFolder:= " & objFolder
<FONT COLOR="#00007F">Set</FONT> objFolder = <FONT COLOR="#00007F">Nothing</FONT>
<FONT COLOR="#00007F">Set</FONT> objShell = <FONT COLOR="#00007F">Nothing</FONT>
<FONT COLOR="#00007F">End</FONT> <FONT COLOR="#00007F">Sub</FONT>
</pre>