FileDialog mso folder Picker
You can have the user pick a file, but return the folder it is in...
'--
Function GetMeAFolderOnly() As String
Dim fso As Object
Dim msg As String
With Application.FileDialog(msoFileDialogFilePicker)
.InitialFileName = "C:\"
If .Show = -1 Then
msg = .SelectedItems(1)
Else
Exit Function
End If
End With
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(msg) Then
msg = fso.getparentfoldername(msg)
GetMeAFolderOnly = msg
Else
GetMeAFolderOnly = "Invalid"
End If
Set fso = Nothing
End Function
'--
'Call function...
Sub FolderName()
MsgBox GetMeAFolderOnly
End Sub
--
Jim Cone
Portland, Oregon USA
(thanks in advance is meaningless)
"CmK"
wrote in message
Hi
I have tried looking everywhere no one seem to have an answer
is there a File Dialog box
that allows people to pick folders only but still shows the files iinside
the folder
Thanks in Advance
|