VBA user forms

  • Thread starter Thread starter robert_woodie
  • Start date Start date
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
 
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
 
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???)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top