VBA user forms

R

robert_woodie

I have a user form which simpily inputs a couple of strings a
variables. However i would like to enter a filepath, is it possible t
have a but which allows the user to select a file and have that fil
path put in the text box?

Cheers
Rober
 
R

robert_woodie

ok i found this in answer to my own question:

Sub OpenOneFile()
Dim fn As Variant
fn = Application.GetOpenFilename("Excel-files,*.xls", _
1, "Select One File To Open", , False)
If TypeName(fn) = "Boolean" Then Exit Sub
' the user didn't select a file
Debug.Print "Selected file: " & fn
Workbooks.Open fn
End Sub

However this opens the file i would like to just store the filepath a
a the variable fn.

Cheer
 
D

Dave Peterson

xl2002+ Then look at:
Application.FileDialog(msoFileDialogFolderPicker)
in the help.

If before, then Jim Rech has a BrowseForFolder routine at:
http://www.BMSLtd.co.uk/MVP/Default.htm
(look for BrowseForFolder)

(You did mean that you wanted the user to select the folder???)
 
Top