设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

12345下一页
返回列表 发新帖
查看: 8814|回复: 42

[宏/菜单/工具栏] 支持多选的文件对话框

[复制链接]
发表于 2007-12-13 22:17:30 | 显示全部楼层 |阅读模式
需引用 Microsoft Office 10.0 Object Library 或更高版本
  1. Dim fDialog As Office.FileDialog
  2. Dim varFile As Variant

  3. 'Clear listbox contents.
  4. Me.FileList.RowSource = ""

  5. 'Set up the File Dialog.
  6. Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
  7. With fDialog
  8. 'Allow user to make multiple selections in dialog box
  9. .AllowMultiSelect = True

  10. 'Set the title of the dialog box.
  11. .Title = "lease select one or more files"

  12. 'Clear out the current filters, and add our own.
  13. .Filters.Clear
  14. .Filters.Add "Access Databases", "*.MDB"
  15. .Filters.Add "Access Projects", "*.ADP"
  16. .Filters.Add "All Files", "*.*"

  17. 'Show the dialog box. If the .Show method returns True, the
  18. 'user picked at least one file. If the .Show method returns
  19. 'False, the user clicked Cancel.
  20. If .Show = True Then
  21. 'Loop through each file selected and add it to our list box.
  22. For Each varFile In .SelectedItems
  23. Me.FileList.AddItem varFile
  24. Next
  25. Else
  26. MsgBox "You clicked Cancel in the file dialog box."
  27. End If
  28. End With
复制代码

游客,如果您要查看本帖隐藏内容请回复

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
发表于 2007-12-13 22:21:13 | 显示全部楼层
我下了看看,呵呵
发表于 2007-12-13 22:21:57 | 显示全部楼层
难得坐了个沙发也,真不错,ANDYMARK真是太好了,哈哈哈
发表于 2007-12-13 22:24:14 | 显示全部楼层
学习。。。。好奇怪的功能。。
发表于 2007-12-13 22:25:33 | 显示全部楼层
不奇怪,很实用的一个功能,嘿嘿,
发表于 2007-12-14 08:00:46 | 显示全部楼层
謝謝分享!
发表于 2007-12-14 08:09:21 | 显示全部楼层
应该学习看看下载了呀
发表于 2007-12-14 08:10:53 | 显示全部楼层
学习没发现的好功能呀

点击这里给我发消息

发表于 2007-12-14 09:09:42 | 显示全部楼层
很好的代码!!

点击这里给我发消息

发表于 2007-12-14 23:22:14 | 显示全部楼层
好东西,支持......
不知Access2000能不能用?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-3-28 20:34 , Processed in 0.122906 second(s), 36 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表