ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
WMWilliam Miller13/04/2018

Hello all,

I currently am running a macro that opens a folder browser dialogue that has a root folder as the currently open drawing's containing folder. When I use the code below, I cannot see any parent folders however. Is there a way to change this?

'Both arguements are optional. The first is the dialog caption and the second is is to specify the top-most visible folder in the hierarchy. The default is "My Computer."

Function SelectFolder(Optional Title As String, Optional TopFolder As String) As String

    Dim objShell As New Shell32.Shell

    Dim objFolder As Shell32.Folder

    'If you use 16384 instead of 1 on the next line, files are also displayed

    Set objFolder = objShell.BrowseForFolder(0, Title, 1, TopFolder)

    If Not objFolder Is Nothing Then

        SelectFolder = objFolder.Items.Item.Path

    End If

End Function

I come up with something like this, but I can't the containing folder (or any more after that) of TEST FILES: