Identify invalid folder in VBA

R

rcl2884

I would like users to enter a folder in a worksheet where data will be
stored, but would like to catch invalid folder names in VBA so that I
do not get an error if I pass the invalid folder to the file system
object.

Obviously, I can parse the string myself looking for invalid
characters and counting backslashes etc, but I thought there might be
an easier way to do this. Any ideas?

Thanks, Rick
 
I

isabelle

hi,

Sub SelectPath()
Dim fd As FileDialog
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
With fd
.Show 'afficher la boite de dialogue
Range("A1") = .SelectedItems(1) 'adapt range
End With
End Sub
 

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