VBA user form

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
 
N

nath

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

Cheers
Robert


---


.
Look at www.mvps.org and dev anishs access web. There is
a file tree thingy on there that is quite simple to
use/understand
 
B

Bob Flanagan

Robert, you could assoiciate the following code with the button (refer to
the macro name in the button's click event):

Sub Select_A_File()
Dim sFile, I As Integer
'display dialog asking user to select a file
sFile = Application.GetOpenFilename _
("Files (*.xls),*.xls", , "Select A File")

'check to see if cancel selected in the box
If sFile = "False" Then

MsgBox "No file selected. Activity halted."
End
End If
End Sub

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
Top