View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default prompt user to specify a directory

I'm sorry, you said browse for folder, not browse for file. I use the API
call that has already been posted.



"JMB" wrote:

Either one of these may be of some use to you.

Sub test()
Dim FName As String
Dim WkBk As Workbook

FName = Application.GetOpenFilename
If FName < "False" Then _
Set WkBk = Workbooks.Open(Filename:=FName)
End Sub

Sub Test2()
Dim WkBk As Workbook

Application.Dialogs(xlDialogOpen).Show
If ActiveWorkbook.Name < ThisWorkbook.Name Then _
Set WkBk = ActiveWorkbook
End Sub



"mini" wrote:

Hi,
How do I prompt user to specify a directory? I don't want them to type in
the directory but instead they can browse around and select the correct path
just like in "Open File".
Thanks a lot,
Mini