Ask Your Question

Using standard dialog to choose directory [closed]

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

cedlemaitre gravatar image

updated 2020-07-20 23:32:07 +0100

Alex Kemp 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 reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-07-20 23:32:14.899830

1 Answer

Sort by » oldest newest most voted

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

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

Question Tools

1 follower


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

Seen: 627 times

Last updated: Nov 21 '17