15 Replies Latest reply on Mar 19, 2018 4:45 AM by Jonas Grazys

    How can I load FileDialog? (VBA)

    Filip Vymola

      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.