I have found a working code that can choose multiple file names. But I can not make it write these names on a column.
I have tried to define a cell address with a variable, but it gives error.
here is the main code, that works without a problem.
Code: Select all
REM ***** BASIC *****
Option Explicit
Sub Selectmultifiles(evt As Object)
Dim FP As Object, files() As String
Dim repCommun As String, info As String, LF As String
Dim selFile As Variant, typeFP As Variant
Dim x As Long
LF = chr(10)
FP = CreateUnoService("com.sun.star.ui.dialogs.SystemFilePicker")
FP.setMultiSelectionMode(True)
FP.Title = "Choose Multiple Files"
if FP.execute = com.sun.star.ui.dialogs.ExecutableDialogResults.OK then
files() = FP.getFiles()
On Error Resume Next
selFile = FP.getSelectedFiles()
On Error GoTo 0
if IsEmpty(selFile) then
info = info & LF & ".SelectedFiles don't exist."
else
info = info & LF & ".SelectedFiles :" & LF
for x = 0 to UBound(selFile)
info = info & x & " : " & selFile(x) & LF
next
end if
MsgBox(info, 0, "FilePicker : " )
end if
FP.dispose
End Sub
Code: Select all
cello=thiscomponent.sheets(0).getcellbyposition(0, x)
cello.string = selFile(x)
How should I modify this?
By the way, this code does not work in openoffice due to some bug. Instead I work it on LO 6.0