[FONT=Consolas][COLOR=#595959]Function GetFileNames(asName() As String) As Long[/COLOR][/FONT]
[COLOR=#595959][FONT=Consolas] ' Returns a list of file names in dynamic array asName and the count of files returned[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] Dim nFile As Long[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] Dim iFile As Long[/FONT][/COLOR]
[FONT=Consolas][COLOR=#595959] [/COLOR][/FONT]
[COLOR=#595959][FONT=Consolas] With Application.FileDialog(msoFileDialogFilePicker)[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] .AllowMultiSelect = True[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] .Filters.Clear[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] .Filters.Add "Excel files", "*.xls", 1 ' position 1[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] .Filters.Add "All Files", "*.*", 2 ' position 2[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] .FilterIndex = 1 ' use the first as default[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] .ButtonName = "Load" ' on save/open button[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] .Title = "Whatever"[/FONT][/COLOR]
[FONT=Consolas][COLOR=#595959] [/COLOR][/FONT]
[FONT=Consolas][COLOR=#595959] [/COLOR][/FONT][FONT=Consolas][COLOR=#595959]If .Show Then[/COLOR][/FONT]
[COLOR=#595959][FONT=Consolas] nFile = .SelectedItems.Count[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] ReDim asName(1 To nFile)[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] For iFile = 1 To nFile[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] asName(iFile) = .SelectedItems(iFile)[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] Next iFile[/FONT][/COLOR]
[COLOR=#595959][FONT=Consolas] GetFileNames = nFile[/FONT][/COLOR]
[FONT=Consolas][COLOR=#595959] [/COLOR][/FONT]
[FONT=Consolas][COLOR=#595959] [/COLOR][/FONT][FONT=Consolas][COLOR=#595959]Else[/COLOR][/FONT]
[COLOR=#595959][FONT=Consolas] nFile = 0 ' Cancelled[/FONT][/COLOR]
[FONT=Consolas][COLOR=#595959] [/COLOR][/FONT][FONT=Consolas][COLOR=#595959]End If[/COLOR][/FONT]
[COLOR=#595959][FONT=Consolas] End With[/FONT][/COLOR]
[FONT=Consolas][COLOR=#595959]End Function[/COLOR][/FONT]