K
Kou Vang
I am using the "How to use the common dialog API in a database in access
2003" example in the KB for my project. I have Access 2000, not sure if
that's the problem, but I can't get the filename to come up in my listbox?
It specifies a textbox, but does it make a difference? Thanks.
http://support.microsoft.com/kb/888695/en-us
Private Sub CmdGetXls_Click()
Me!LstXlsFiles = GetFiles(Me)
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
"GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private 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
Function GetFiles(TubeImport As Form) As String
Dim OpenFile As OPENFILENAME
Dim lReturn As Long
Dim sFilter As String
Dim sTmp As String
Dim sPath As String
Dim I As Integer
OpenFile.lStructSize = Len(OpenFile)
OpenFile.hwndOwner = TubeImport.Hwnd
sFilter = "Excel Files (*.xls)" & Chr(0) & "*.xls" & Chr(0)
OpenFile.lpstrFilter = sFilter
OpenFile.nFilterIndex = 1
OpenFile.lpstrFile = String(257, 0)
OpenFile.nMaxFile = Len(OpenFile.lpstrFile) - 1
OpenFile.lpstrFileTitle = OpenFile.lpstrFile
OpenFile.nMaxFileTitle = OpenFile.nMaxFile
OpenFile.lpstrInitialDir = "n:\trafmon\vc_data\newtube"
OpenFile.lpstrTitle = "Select a file using the Common Dialog DLL"
OpenFile.flags = 0
lReturn = GetOpenFileName(OpenFile)
'Debug.Print OpenFile.lpstrFile
End Function
End Sub
2003" example in the KB for my project. I have Access 2000, not sure if
that's the problem, but I can't get the filename to come up in my listbox?
It specifies a textbox, but does it make a difference? Thanks.
http://support.microsoft.com/kb/888695/en-us
Private Sub CmdGetXls_Click()
Me!LstXlsFiles = GetFiles(Me)
Private Declare Function GetOpenFileName Lib "comdlg32.dll" Alias _
"GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Private 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
Function GetFiles(TubeImport As Form) As String
Dim OpenFile As OPENFILENAME
Dim lReturn As Long
Dim sFilter As String
Dim sTmp As String
Dim sPath As String
Dim I As Integer
OpenFile.lStructSize = Len(OpenFile)
OpenFile.hwndOwner = TubeImport.Hwnd
sFilter = "Excel Files (*.xls)" & Chr(0) & "*.xls" & Chr(0)
OpenFile.lpstrFilter = sFilter
OpenFile.nFilterIndex = 1
OpenFile.lpstrFile = String(257, 0)
OpenFile.nMaxFile = Len(OpenFile.lpstrFile) - 1
OpenFile.lpstrFileTitle = OpenFile.lpstrFile
OpenFile.nMaxFileTitle = OpenFile.nMaxFile
OpenFile.lpstrInitialDir = "n:\trafmon\vc_data\newtube"
OpenFile.lpstrTitle = "Select a file using the Common Dialog DLL"
OpenFile.flags = 0
lReturn = GetOpenFileName(OpenFile)
'Debug.Print OpenFile.lpstrFile
End Function
End Sub