Using xlDialogFindFile to get filename and path.
Thanks very much Per,
That works 100%!
Henry
Per Jessen wrote:
Hi
You should use "GetOpenFileName".
MyFile = Application.GetOpenFilename
If fileToOpen < False Then
MsgBox MyFile
End If
Regards,
Per
"Henry" skrev i meddelelsen
...
I'm trying to get a filename and path from users using
xlDialogFindFile. I don't want the selected file to be opened.
1) How do I get xlDialogFindFile to open showing .doc and .txt as the
default type files?
2) How do I get the selected filename and path returned from
xlDialogFindFile without opening the file?
3) How do I stop xlDialogFindFile causing an error when a .doc or
.txt file is chosen?
If I'm trying to use the wrong dialog, can you please point me to
what I should use instead.
I realise that I could design my own dialog, but why re-invent the
wheel? I've not got very far with the code, but here it is.
Private Sub BrowseButton1-Click()
Dim MyFile
MyFile = Application.Dialogs(xlDialogFindFile).Show <--------
'<--------- Returns error if non XL file selected, opens file and
returns "True" if XL file selected
MsgBox MyFile
End Sub
|