加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如何在VB 中直接打开并选择目录,而不使用麻烦的多个控件?

发布时间:2020-12-16 23:12:12 所属栏目:大数据 来源:网络整理
导读:之前使用过一种方法,很简单,在VB6 或 VBA 中均可使用,代码如下: * 但有一个前提条件,因使用到 Shell32.DLL ,故必须先引用 "Microsoft Shell Controls And Automation" 才可以正常使用。 Dim objShell As New Shell32.Shell Dim oFd As Shell32.Folder2

之前使用过一种方法,很简单,在VB6 或 VBA 中均可使用,代码如下:

* 但有一个前提条件,因使用到 Shell32.DLL ,故必须先引用 "Microsoft Shell Controls And Automation" 才可以正常使用。

Dim objShell As New Shell32.Shell
Dim oFd As Shell32.Folder2

Set oFd = objShell.BrowseForFolder(Me.Hwnd,"Please choice the folder include target excel files.",16 + 64) If Not oFd Is Nothing Then txtFolder.Text = IIf(Right(oFd.Self.Path,1) = "/",oFd.Self.Path,oFd.Self.Path & "/") Else Exit Sub End If

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读