VB源代码

浏览文件夹对话框

2017-04-27  本文已影响0人  因思道客

使用Shell对象的的方式获取选择的文件夹路径

Private Sub cmdDir_Click()
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.BrowseForFolder(0, "选择文件夹", 0, 0)
    
    If Not objFolder Is Nothing Then
        txtDir.Text = objFolder.self.Path
    Else
        Exit Sub
    End If
    
    Set objFolder = Nothing
    Set objShell = Nothing
    
End Sub
上一篇 下一篇

猜你喜欢

热点阅读