AnsweredAssumed Answered

How can I load FileDialog? (VBA)

Question asked by Filip Vymola on Oct 12, 2017
Latest reply on Mar 29, 2019 by Niels Raahauge

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.

Outcomes