ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   common dialog box (https://www.excelbanter.com/excel-programming/294381-common-dialog-box.html)

inquirer

common dialog box
 
I am using a common dialog box on a form and want to get the path to a
directory. I have

Private Sub GetdataDir()
CommonDialog2.InitDir = "C:\my databases\"
CommonDialog2.DialogTitle = "Browse for Datafile directory"
CommonDialog2.Filter = "Data files directory (*.*)|*.*"
CommonDialog2.DefaultExt = ".*"
CommonDialog2.ShowOpen
TextBox26.Value = CommonDialog2.filename
End Sub
Which works OK for getting files but can I use it to get the directory path
only eg c:\my databases\

Also is there a way to allow slection of multiplefiles?

Thanks
Chris



Bill Renaud[_2_]

common dialog box
 
Let the user browse the directories using either of the following code
(GetOpenFilename is probably easier to program):

Application.Dialogs(xlDialogOpen).Show
Application.GetOpenFilename

Then select a file or cancel out of the dialog box. Then simply fetch the
current directory using the following code after the dialog box has been
exited:

strCurrentDirectory = CurDir

Also is there a way to allow slection of multiple files?


Application.GetOpenFilename(MultiSelect:=TRUE)
--
Regards,
Bill


"inquirer" wrote in message
...
I am using a common dialog box on a form and want to get the path to a
directory. I have

Private Sub GetdataDir()
CommonDialog2.InitDir = "C:\my databases\"
CommonDialog2.DialogTitle = "Browse for Datafile directory"
CommonDialog2.Filter = "Data files directory (*.*)|*.*"
CommonDialog2.DefaultExt = ".*"
CommonDialog2.ShowOpen
TextBox26.Value = CommonDialog2.filename
End Sub
Which works OK for getting files but can I use it to get the directory

path
only eg c:\my databases\

Also is there a way to allow slection of multiplefiles?

Thanks
Chris






All times are GMT +1. The time now is 06:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com