browse for file in specific directory (1 Viewer)

deekras

Registered User.
Local time
Today, 20:09
Joined
Jun 14, 2000
Messages
169
i want to have abutton that users click and then browse for file

i found this
Attachment: filefinder.zip, which is basically this:

Dim OFN As OPENFILENAME
On Error GoTo Err_BtnLocateImport_Click

' Set options for dialog box.
With OFN
.lpstrTitle = "Locate Import File"
If Not IsNull(LocateFile) Then .lpstrFile = LocateFile
.flags = &H1804 ' OFN_FileMustExist + OFN_PathMustExist + OFN_HideReadOnly
.lpstrFilter = MakeFilterString("Specific File Types (*.xls)", "*.xls", _
"All files (*.*)", "*.*")
End With


If OpenDialog(OFN) Then
LocateFile = OFN.lpstrFile
'[imgPicture].Picture = [PicFile]
'SysCmd acSysCmdSetStatus, "Afbeelding: '" & LocateFile & "'."
End If
Exit Sub



it is a good start, but i also want to specify the path (directory) that should be default where to start browsing.

ie: i know that the file should be saved in f:\mailing\current, i want it to open to that directory. (i know it opens to the last directory i was opened to)

and i want it to display by creation date descending.


any ideas?
 

Nero

Shop smart, shop S-Mart
Local time
Today, 20:09
Joined
Jan 8, 2002
Messages
217
You could use the common dialog control and then put some code behind a button similar to this

Code:
Me.ActiveXCtl62.InitDir = "G:\Your Directory Name"
Me.ActiveXCtl62.Filter = "*.doc|*.doc"
Me.ActiveXCtl62.ShowOpen

Change the *.doc file extensions to the file extensions that you require to filter on.
 

Users who are viewing this thread

Top Bottom