zal je de windows api's moeten gebruiken, google eens naar apiviewer, krijg je zo'n beetje alle beschikbare api-functies te zien met vb voorbelden.
dit werkt in ieder geval bij mij:
Option Compare Database
Option Explicit
Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Declare Function GetOpenFileName Lib "comdlg32.dll" _
Alias "GetOpenFileNameA" (pOPENFILENAME As OPENFILENAME) _
As Long
Declare Function GetSaveFileName Lib "comdlg32.dll" _
Alias "GetSaveFileNameA" (pOPENFILENAME As OPENFILENAME) _
As Long
Function OpenBestand() As String
Dim xOpenBestand As OPENFILENAME
Dim Bericht As String
xOpenBestand.lStructSize = Len(xOpenBestand)
xOpenBestand.hwndOwner = Form_frmImporteren.Hwnd
xOpenBestand.lpstrFilter = "Tekstbestanden (*.txt)" + Chr$(0) + "*.*"
xOpenBestand.lpstrFile = Space$(254)
xOpenBestand.nMaxFile = 255
xOpenBestand.lpstrFileTitle = Space$(254)
xOpenBestand.nMaxFileTitle = 255
xOpenBestand.lpstrInitialDir = "C:\JP CWI\2006"
xOpenBestand.lpstrTitle = "Importeren"
xOpenBestand.flags = 0
If GetOpenFileName(xOpenBestand) > 0 Then
End If
OpenBestand = Trim$(xOpenBestand.lpstrFile)
End Function