ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identify invalid folder in VBA (https://www.excelbanter.com/excel-programming/444718-identify-invalid-folder-vba.html)

rcl2884

Identify invalid folder in VBA
 
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

isabelle

Identify invalid folder in VBA
 
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

--
isabelle



All times are GMT +1. The time now is 03:01 PM.

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