ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA user form (https://www.excelbanter.com/excel-programming/299393-vba-user-form.html)

robert_woodie[_3_]

VBA user form
 
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

--
Message posted from http://www.ExcelForum.com


nath

VBA user form
 

-----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


---
Message posted from http://www.ExcelForum.com/

.
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

Bob Flanagan

VBA user form
 
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


"robert_woodie " wrote in
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


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 12:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com