Vikki_Purohit Vikki_Purohit - 6 months ago 70 Question

Retrieve Data From a Folder

Hello Friends,
I am doing coding in have some excel files in one folder. I want that all files need to be merged in windows form application. but i want to select a folder and retrieve all files. please can anyone help me in this?


You could try something like this in your code :-

Dim fd As OpenFileDialog = New OpenFileDialog()
        fd.Title = "Select Excel File"
        'insert your drive specs here 'if specific directory is searched.
        fd.InitialDirectory = D_Drive + "\programs"
        fd.Filter = "All files (*.xls)|*.xls|All files (*.xls)|*.xls"
        fd.FilterIndex = 2
        fd.RestoreDirectory = True
        If fd.ShowDialog() = DialogResult.OK Then
            filec = fd.FileName
        End If

        If filec <> "" Then
            Shell("Excel " + filec, AppWinStyle.MaximizedFocus, True)
        End If