在Access 2007中打开“文件对话框"并获取文件路径 [英] Open File Dialoge in Access 2007 and get the file path

查看:130
本文介绍了在Access 2007中打开“文件对话框"并获取文件路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打开文件对话框并获取Access 2007中所选路径的目录.

我知道要打开文件对话框,但我不知道该函数会返回您使用的F.FileName目录,但会给我一个错误.这是我使用的代码:

I want to open the file dialog and get the directory of the selected path in access 2007.

I know to open the file dialog but I did not know the function that return you the directory I used F.FileName but gives me an error. this is the code that I used:

Dim f    As Object
Set f = Application.FileDialog(msoFileDialogFilePicker)
f.AllowMultiSelect = False
f.Title = "Please Select an Excel Sheet"
f.Filters.Clear
f.Show
txt_Path.Text = f.FileNameToString()//gives me Error how can i fix it


错误是对象不支持此属性或方法"


the error is "Object does not support this property or method"
Can any one help me in doing that?

推荐答案

您可能需要使用FileDialog.SelectedItems(即使只有一个选定的项目).

请参阅 http://msdn.microsoft.com/en-us/library/aa432435(v = office.12).aspx [
You probably need to use FileDialog.SelectedItems (even if there is only one selected item).

See http://msdn.microsoft.com/en-us/library/aa432435(v=office.12).aspx[^]


您需要遍历所选文件,使其一个一个地

You would need to loop through the selected file get them one by one

'Loop through each file selected and do whatever you want to do with it.
For Each varFile In .SelectedItems
  'varFile - this is your file name
Next




来源:
http://bytes.com/topic/access/answers/539285-file-dialog [< ^ ]




Souce: http://bytes.com/topic/access/answers/539285-file-dialog[^]


这篇关于在Access 2007中打开“文件对话框"并获取文件路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆