I copied this code from ‘LibreOffice Macros & Dialogs’ > ‘Tools’ > ‘UCB’ > ‘Main’
Sub Main()
Dim LocsfileContent(0) as String
LocsfileContent(0) = "*"
ReadDirectories("file:///space", LocsfileContent(), True, False, false)
End Sub
The first problem with this code is the order of the parameters in ReadDirectories() is not correct. If you look at ReadDirectories() you see that the order is:
ByVal AnchorDir As String,
bRecursive as Boolean,
bcheckFileType as Boolean,
bGetByTitle as Boolean,
Optional sFileContent(),
Optional sExtension as String
Mapping the parms gives:
AnchorDir = "file:///space"
bRecursive = LocsfileContent()
This is incorrect
bcheckFileType = True
bGetByTitel = False
sFileContent = false
This is incorrect
The parameter sFileContent() (LocsfileContent()
) should be last not second. Once I discovered this I was able to get ReadDirectores to work. The next problem I found is Directory names that end in a space (allowed on the Mac not in Windows) are not handled correctly. If the Directory name ending with a space happens to be the AnchorDir the function returns a message that the directory does not exist. If the Directory name ending with a space is in a subdirectory (bRecursive = True) the files in the directory are skipped with no message indicating that something was amiss.
The last problem is Function ReadDirectores() works sometimes and other times it returns an error message ReadDirectores() not found. I am unable to determine why it works sometimes but not always.
Has anybody else tried to use this function?