Add files from a folder to list box in user form

Hi all,

I have a user form that lets you click a button to open the file explorer and select a file to be imported.

I would love to change this to a list box that is auto-populated from a list of files in a specific folder, but unfortunately, I am just lost.

Any guidance would be much appreciated.

Thanks

Craig

Parents
No Data
Reply
  • Just thought I would add this to the post as I managed to get it working.

        Private Sub UserForm_Activate()
        Dim FoundationFolder As String
        Dim FoundationFile As String
        Dim j As Integer
        FoundationFolder = "C:\Users\cwats\OneDrive - Watson Memorials\Watson Memorials\Designs Template and Drawings\MD UK\Memorial Shapes\Foundations"
        FoundationFile = Dir(FoundationFolder & "\*.cdr")
        Do While FoundationFile <> ""
        ListFoundationFilesDropdown.AddItem FoundationFile
        FoundationFile = Dir
        Loop
             Dim DimensionFolder As String
             Dim DimensionFile As String
             Dim k As Integer
             DimensionFolder = "C:\Users\cwats\OneDrive - Watson Memorials\Watson Memorials\Designs Template and Drawings\MD UK\Dimensions"
            DimensionFile = Dir(DimensionFolder & "\*.cdr")
            Do While DimensionFile <> ""
            ListDimensionFilesDropdown.AddItem DimensionFile
            DimensionFile = Dir
         Loop
         End Sub

Children
No Data