Thread: VBA user form
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Flanagan Bob Flanagan is offline
external usenet poster
 
Posts: 340
Default 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/