ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
FVFilip Vymola12/10/2017

Hello all,

how can I load FileDialog from UserForm? I need load folder path to TextBox and I need open FileDialog via button.  How can I set it? If I use this code:

    Dim fDialog As FileDialog, result As Integer

    Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)

    'Optional: FileDialog properties

    fDialog.Title = "Select a folder"

    fDialog.InitialFileName = "C:\"

    

    If fDialog.Show = -1 Then

      Debug.Print fDialog.SelectedItems(1)

    End If

macro end with error: Object doesn't support this property or method.

Do I have to set some object as SldWorks? In my opinion this is process in Windows, not in Solidworks. I haven't got allow some library (Tools -> References).

Thnaks a lot for your answers.