Using standard dialog to choose directory

I know it’s possible to get a fuul file path using standard file dialog but how to get a directory path?

TY for your help

Hello @cedlemaitre,

to get a directory path, you could use the System FolderPicker and pass its result to ConvertFromURL():

Function selectFolder(strTitle as String, strInitPath as String) as String
REM Opens the FolderPicker dialog and returns the URL of the selected Folder.
	Dim oFolderPicker	: oFolderPicker = CreateUnoService( "com.sun.star.ui.dialogs.FolderPicker" )
	oFolderPicker.setTitle( strTitle )
	oFolderPicker.setDisplayDirectory( strInitPath )
	If oFolderPicker.execute() = 1 Then selectFolder = oFolderPicker.getDirectory()
End Function

'strPath = ConvertFromURL( selectFolder( "TITLE", "" ) )
1 Like