Adding browse button to userform

B

Brad

Hi all,

I'm trying to add a browse button to a custom userform.
The goal is to capture the path and filename the user
selects, display it in the text box, and set it equal to a
variable. I know it has to use a file system object, but
I don't know where to go from there. Any help/code would
be appreciated.

-Brad
 
T

Tom Ogilvy

Private Sub CommandButton1_Click()
Dim fName as String
fName = Application.GetOpenFileName()
if not fName = "False" then
Textbox1.Value = fName
End if
end Sub


See Excel VBA help on Application.GetOpenFilename for options such as
filetype.

Use Chdrive and Chdir to start at a specific location.
 
Top