View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Embed Folder Treeview Or Windows Explorer On UserForm

application.getopenfilename()

seems like it should work. You can even use multiselect:=true to get more than
one filename in that same folder.

Option Explicit
Sub testme01()

Dim myFileNames As Variant
Dim wkbk As Workbook
Dim fCtr As Long

myFileNames = Application.GetOpenFilename("Excel Files, *.xls", _
MultiSelect:=True)

If IsArray(myFileNames) = False Then
Exit Sub
End If

For fCtr = LBound(myFileNames) To UBound(myFileNames)
Set wkbk = Workbooks.Open(FileName:=myFileNames(fCtr))
'do some things
wkbk.Close savechanges:=True 'or False???
Next fCtr

End Sub

============
If you're looking for a name to save a file, look at
Application.GetSaveAsFilename in VBA's help.

MDW wrote:

Hello.

I'd like to create a UI where my users can graphically navigate through
folder lists and select files. I don't want to programmatically invoke the
Windows Explorer unless there's a way to embed it on a Userform (I don't want
it in a seperate window).

I looked at the TreeView control, and it looks like it will satisfy at least
the folder browsing part, but I seem to recall that there's a control
somewhere that's already set up to display folders in a similar fashion. I
can't for the life of me remember what it is, though.

And advice/pointers would be appreciated. I don't want to reinvent the wheel
using a TreeView if there's another option. Thanks.
--
Hmm...they have the Internet on COMPUTERS now!


--

Dave Peterson