foldername only

hi,

Dim MyPath As String
    MyPath = SelectFolder("Select Folder", "")
    If Len(MyPath) Then
        MsgBox MyPath
    Else
        MsgBox "Cancel was pressed"
    End If

TextBox2.Text = MyPath

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

example :  TextBox2.Text =  D:\\Solidworks API\oldfile

i used above code for folder path. but ineed to show folder name only.

Example

example : TextBox2.Text = oldfile

SolidworksApi macros