Adding browse button to userform

  • Thread starter Thread starter Brad
  • Start date Start date
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
 
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.
 

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