View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
Steve Yandl Steve Yandl is offline
external usenet poster
 
Posts: 284
Default Is there a Folder Picker method that shows files too?

If I'm doing this with a vbScript file, I typically use the
"Scripting.FileSystemObject" to retrieve an appropriate parent folder or
drive, depending on where I want to start. The "Shell.Application" object
does offer a number of options other than the MyDocuments folder if you want
to stick to what I've got.
Here is a link to info on getting the path to various special folders:
http://www.microsoft.com/technet/scr....mspx?mfr=true

For some good information on using BrowseForFolder (written for script
writers but easy to use in a VBA routine, check out:
http://wsh2.freeweb.hu/ch12f.html


Steve Yandl



"tenlbham" wrote in message
...
Excellent, that's almost it!!! Thanks.

Question: this current browser object doesn't appear to give me the
option
to go up to parent folders, is there a way to change that?

This is a different way of coding for me so I don't recognize how to
change
the various options. Although I did figure out that the "&H5" was a
reference to My Documents (as changing it to H0-H9 set the directory to
various locations), and "&H4001" is perhaps some sort of filter. I was
able
to get the browser to display NO files when I changed it to "&H1001"


"Steve Yandl" wrote:

Dim objShell
Dim objFldr

Set objShell = CreateObject("Shell.Application")
Set objMyDocs = objShell.Namespace(&H5)
pathMyDocs = objMyDocs.Self.Path

On Error Resume Next
Set objFldr = objShell.BrowseForFolder(0, "pick me", &H4001, pathMyDocs)

If Not (objFldr Is Nothing) Then
MsgBox objFldr.Items.Item.Path
End If

Set objFldr = Nothing
Set objShell = Nothing




"tenlbham" wrote in message
...
Thanks, but this is a file picker. I cannot use it to select a folder.