【SolidWorks宏】选择文件夹

Rem 选择文件夹
Public Sub SG_BrowseForFolder()
    
        '** 使用Shell.Application对象来选择文件夹
        Dim objShell
        Dim objFolder
        Dim strPath As String
       
        Set objShell = CreateObject("Shell.Application")
       
        '** 显示选择文件夹对话框
        Set objFolder = objShell.BrowseForFolder(0, "选择文件目录", 0, 0)
       
        If Not objFolder Is Nothing Then        '** 用户选择了文件夹
            strPath = objFolder.self.Path
        Else
            strPath = ""
        End If
       
        Set objFolder = Nothing
        Set objShell = Nothing
End Sub

猜你喜欢

转载自blog.csdn.net/chenlu5201314/article/details/80342879
今日推荐