Ask Your Question

Using standard dialog to choose directory

asked 2017-11-21 10:50:32 +0200

cedlemaitre gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-11-21 13:20:14 +0200

librebel gravatar image

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( "" )
    oFolderPicker.setTitle( strTitle )
    oFolderPicker.setDisplayDirectory( strInitPath )
    If oFolderPicker.execute() = 1 Then selectFolder = oFolderPicker.getDirectory()
End Function

'strPath = ConvertFromURL( selectFolder( "TITLE", "" ) )
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-11-21 10:50:32 +0200

Seen: 461 times

Last updated: Nov 21 '17