Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using xlDialogFindFile to get filename and path.
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using xlDialogFindFile to get filename and path.
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo | Excel Discussion (Misc queries) | |||
How to get info of new filename and new path | Excel Programming | |||
showing path and filename | Excel Worksheet Functions | |||
What's the future status of xlDialogFindFile? | Excel Programming | |||
Filename and path | Excel Programming |