Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get a file path without open the file from xldialog

Status
Not open for further replies.

shaoxk66

Technical User
Jan 25, 2007
9
CA
i want to get file's access path as string, not open the file.

the code should be like:

Dim msg As String

Application.FileDialog(msoFileDialogFolderPicker).Show
msg = Application.FileDialog(msoFileDialogFilePicker).SelectedItems(1)

by using this filedialog, i can only have folder's directory, but can not see any file.
can anybody give me an idea which built-in dialog i could use to get file path.

Thanks
 





Hi,

What APPLICATION?

Skip,

[glasses] When a wee mystic is on the loose..
It's a Small Medium at Large! [tongue]
 




Check out the GetOpenFilename Method

Skip,

[glasses] When a wee mystic is on the loose..
It's a Small Medium at Large! [tongue]
 
Skip,
Thanks so much. the function returns just what i want.
 
I use GetOpenFilename myself, but if you wanted to use FileDialog you would do something like:
Code:
With Application.FileDialog(msoFileDialogFilePicker)
  .Show
  If .SelectedItems.Count > 0 Then
    MsgBox .SelectedItems(1)
  End If
End With


Regards,
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top