美文网首页VB源代码
浏览文件夹对话框

浏览文件夹对话框

作者: 因思道客 | 来源:发表于2017-04-27 10:35 被阅读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

相关文章

网友评论

    本文标题:浏览文件夹对话框

    本文链接:https://www.haomeiwen.com/subject/sbegzttx.html