显示“打开文件"对话 [英] Show "Open File" Dialog

查看:49
本文介绍了显示“打开文件"对话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 access 2007 VBA 中显示打开的文件(或文件选择)对话框?

How would I go about showing an open file (or file select) dialog in access 2007 VBA?

我已尝试像在 Excel 中一样使用 Application.GetOpenFileName,但 Access 中不存在此函数.

I have tried using Application.GetOpenFileName as I would in Excel, but this function doesn't exist in Access.

推荐答案

我对 Renaud Bompuis 回答的评论搞砸了.

My comments on Renaud Bompuis's answer messed up.

其实可以使用后期绑定,不需要引用11.0对象库.

Actually, you can use late binding, and the reference to the 11.0 object library is not required.

以下代码无需任何引用即可运行:

The following code will work without any references:

 Dim f    As Object 
 Set f = Application.FileDialog(3) 
 f.AllowMultiSelect = True 
 f.Show 

 MsgBox "file choosen = " & f.SelectedItems.Count 

请注意,上述内容也适用于运行时.

Note that the above works well in the runtime also.

这篇关于显示“打开文件"对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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