title: LibreOffice how to get filepicker multiple file selection data
body: <p>In LibreOffice 4.2 I am trying to open the file picker and select multiple files (which I succeeded), and then to transfer the names (and path) of those files to a variable (or array, does not matter).</p>
  
  <p>Although I can open the file picker and select multiple files, I can get the file name and path of only one file (the first one). And I couldn't find any way to get the others.</p>
  
  <p>I am using the following code:</p>
  
  <pre><code>Sub TakeFile()
     Dim FileNames(0 to 100) as String
     FileNames() = fImportLocalFile()
     Msgbox FileNames
  End Sub
  
  Function fImportLocalFile() 'as String
  ' FJCC: Can't define the function as returning a String because now it returns an array
     'this function opens a system file open dialog box and allows the
     '   user to pick a file from thier computer to open into the
     '   document for processing
  
     'stores the filedialog object
     Dim oFileDialog as Object
     'stores the returned result of the activation of the dialog box
     Dim iAccept as Integer
     'stores the returned file name/path from the file dialog box
     Dim sPath as String
     'stores the set default path for the dialog box
     Dim InitPath as String
  
     'stores the types of files allowed in the filedialog
     Dim sFilterNames as String
  
     'setup the filters for the types of files to allow in the dialog
     sFilterNames = "*.csv; *.txt; *.odt; *.ods; *.xls; *.xlt; *.xlsx"
  
     'create the dialog box as a Windows File Dialog
     oFileDialog = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
  
     'set the filters for the dialog
     oFileDialog.AppendFilter("Supported files", sFilterNames)
  
     'set the path as blank
     InitPath = ""
  
     'add the default path to the dialog
     oFileDialog.setDisplayDirectory(InitPath)
  
     'setup the dialog to allow multiple files to be selected
     oFileDialog.setMultiSelectionMode(True)
  
     'set iAccept as the execution of the dialog
     iAccept = oFileDialog.Execute()
  
     'execute and test if dialog works
     If iAccept = 1 Then
        'set sPath as the chosen file from the dialog
        'sPath = oFileDialog.Files(0)
        FileArray = oFileDialog.getFiles() 'added by FJCC
        'set the function as sPath for returning to the previous sub
        fImportLocalFile = FileArray  'modified by FJCC
     'end current if statement
     End If
  
  End Function
  </code></pre>