07-24-2006 12:58 PM
07-25-2006 10:38 AM
02-07-2007 11:30 AM
Hello Julia,
I am looking for something very similar when using a Dialog Box.
I would like to specify the starting directory when I search for files in the Dialog Box. I have two files which I need to select but they are in different directories.
This is my current script and I would like to search at the top of the directory rather than just going to the last file selected directory.
Sub Button1_EventClick()
Dim This : Set This = Button1
MSComDlg1.X.ShowOpen
Editbox1.Text = MSComDlg1.X.filename
If filex(Editbox1.text) Then load.Enable = True Else load.Enable = False
End Sub
Sub Durchsuchen_EventClick()
Dim This : Set This = Durchsuchen
MSCommonDlgAX.X.ShowOpen
FilePath.Text = MSCommonDlgAX.X.FileName
If filex(FilePath.text) Then load.Enable = True Else load.Enable = False
End Sub
Sub EditBox1_EventChange()
Dim This : Set This = EditBox1
If filex(Editbox1.text) Then load.Enable = True Else load.Enable = False
End Sub
Thanks
02-07-2007 04:17 PM
I do not use the "Microsoft Common Dialog" box very often, so am not sure I will be much help. I usually use the "FileNameGet" command (it has lots of helpful input and return parameters), and with this, you can specify which directory you want it to start in. In this example, pushing Button2 gives a file selection dialog where I can select one or more type DAT or TDM files, and the file paths are returned in an array. But I'm not sure if this will help you?
Sub Button2_EventClick()
Dim This : Set This = Button2
Dim DlgTitle, StartPath, FileExts, FilePaths
DlgTitle = "Insert File Dialog Title Here..."
StartPath = ProgramDrv & "Libr\Dat\"
FileExts = "*.DAT;*.TDM"
Call FileNameGet("Any", "FileRead", StartPath, FileExts, "Nul", True, DlgTitle)
FilePaths = Split("|" & FileDlgFileName,"|")
End Sub
02-08-2007 05:23 AM
Hello Julia,
That gets me partly there, but how can I call the filename path and display it in a editbox.
This is to visually make sure that the file I have selected is correct.
Thanks
02-08-2007 08:56 AM
This should display the selected filepath and filename in EditBox1 (below). To "call" the filename path, do you mean, load the specified data file? If so, you should be able to just use Call DataFileLoad(DataFilename, [FileImportFilter], [ImportAction]), where DataFileName = FileDlgDir & FileDlgFile or if you selected multiple files, one or more of the FileDlgFileName files. Does this help?
Sub Button2_EventClick()
Dim This : Set This = Button2
Dim DlgTitle, StartPath, FileExts, FilePaths
DlgTitle = "Insert File Dialog Title Here..."
StartPath = ProgramDrv & "Libr\Dat\"
FileExts = "*.DAT;*.TDM"
Call FileNameGet("Any", "FileRead", StartPath, FileExts, "Nul", True, DlgTitle)
FilePaths = Split("|" & FileDlgFileName,"|")
EditBox1.Text = FileDlgDir & FileDlgFile
End Sub