Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
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 Max Loger Excel Discussion (Misc queries) 0 June 14th 11 04:30 PM
How to get info of new filename and new path Makelei Excel Programming 2 December 12th 08 06:58 AM
showing path and filename Annie Excel Worksheet Functions 1 February 9th 07 01:34 PM
What's the future status of xlDialogFindFile? JK Excel Programming 1 April 26th 06 05:40 PM
Filename and path Mike Excel Programming 1 October 19th 05 07:33 PM


All times are GMT +1. The time now is 08:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"