Capturing a file path

G

Guest

I want to perform a particular action the contents of a folder that the user
chooses.

So I show the dialog box
Application.Dialogs(xlDialogOpen).Show

But how to I capture the folder they select to a string variable?

For example: sChosenFolder = "L:\ExcelFiles\Sept04\"

Thanks in advance

Daniel
 
E

Erik BZ

Try this

Sub test()
With Application.FileDialog(msoFileDialogOpen)
.Show
MsgBox .SelectedItems(1)
End With
End Sub

Good Luck!
Erik BZ
 

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

Top