Clueless Newbie
Immortal. So far.
- Local time
- Today, 21:44
- Joined
- Feb 6, 2004
- Messages
- 48
Hi all,
sorry if this is a daft question - I come from the PERL and JavaScript corner originally and my boss has suddenly decided that I should do some Access stuff as well...
In a project of mine, I'm using the following function:
Once the file is selected, its name including the entire path is written into a text field and, of course, also saved to my table.
What I would also like to do is to limit the files shown for selection in the FileOpen dialog to just .pdf files. Everything else should be suppressed/made invisible.
Alternatively, I could also give out an error message whenever a non-PDF file is selected. I would, however, prefer the first solution, if at all possible.
Does anyone have a clue how I could go about this by any chance? Any help would be most appreciated.
Cheers & have a nice day!
Ute
sorry if this is a daft question - I come from the PERL and JavaScript corner originally and my boss has suddenly decided that I should do some Access stuff as well...
In a project of mine, I'm using the following function:
Code:
Function LaunchCD(strform As Form) As String
Dim OpenFile As OPENFILENAME
Dim lReturn As Long
Dim sFilter As String
OpenFile.lStructSize = Len(OpenFile)
OpenFile.hwndOwner = strform.hwnd
sFilter = "AdobeAcrobat (*.pdf*)" & 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 = "C:\"
OpenFile.lpstrTitle = "Bitte wählen Sie eine Datei aus."
OpenFile.flags = 0
lReturn = apiGetSaveFileName(OpenFile)
If lReturn = 0 Then
MsgBox "Sie haben leider keine Datei ausgewählt!", vbInformation, _
"Bitte wählen Sie eine Datei aus."
Else
LaunchCD = Trim(OpenFile.lpstrFile)
Do Until Right(LaunchCD, 1) <> Chr$(0)
Debug.Print LaunchCD
LaunchCD = Left(LaunchCD, Len(LaunchCD) - 1)
Loop
End If
End Function
Once the file is selected, its name including the entire path is written into a text field and, of course, also saved to my table.
What I would also like to do is to limit the files shown for selection in the FileOpen dialog to just .pdf files. Everything else should be suppressed/made invisible.
Alternatively, I could also give out an error message whenever a non-PDF file is selected. I would, however, prefer the first solution, if at all possible.
Does anyone have a clue how I could go about this by any chance? Any help would be most appreciated.
Cheers & have a nice day!
Ute