![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
#3
| |||
| |||
|
|
What is the code for the function body? Does this function just check file extensions? Like if a given folder contains 20 files of which 3 of the are .dll, 2 are .mdb, 6 are .xls, 4 are .pdf, and 5 are .txt does this function return a count of file types contained in the selected folder? It sounds like all you need is basic File I/O routines with a little bit of string manipulation. Need to see the VBA code of the function's body to be more specific Rich *** Sent via Developersdex http://www.developersdex.com *** |
#4
| |||
| |||
|
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Hi Phil, I only have Access2003 and I played around with the builtin FileDialog but was not able to retrieve filenames with this (unlike Excel where the builtin FileOpenDialog works very nicely). I expect this has been fixed/improved in Acc2010. Try With Application.FileDialog(msoFileDialogOpen) .Show End With Maybe the intellisense will show Filename in the dropdown. This is where you would get the FileName. Or place the cursor on top of FileDialog and press F1 to get help on that. If acc2010 still doesn't have a builtin FileOpenDialog then one alternative would be to try out the code from this site http://www.mvps.org/access/api/api0001.htm This is Allen Browne's site. He has a bunch of API code which works quite well, except that there is a bunch more code that you have to deal with. But this option should work if the simpler option is not available (still) in Acc2010. Rich *** Sent via Developersdex http://www.developersdex.com *** |
#7
| |||
| |||
|
#8
| |||
| |||
|
|
On 15/12/2009 01:58:39, "Albert D. Kallal" wrote: Thanks Albert Spot on, and so simple. In the unlikely event that I want to get the name of one of these new fangled libraries, is there a way of doing that? There does not appear to be a msoFileDialogLibrartPicker in the Object Browser. |
#9
| |||
| |||
|
|
Rich is on the right track. You can use: Dim f As FileDialog Set f = Application.FileDialog(msoFileDialogOpen) f.Filters.Add "text documents", "*.txt" f.Show If f.SelectedItems.count > 0 Then MsgBox "file choose was " & f.SelectedItems(1) Else MsgBox "no file selected" End If The above would set the file filter to *.txt files...you can change that for whatever you want... You can also setup the starting dir as: Dim f As FileDialog Set f = Application.FileDialog(msoFileDialogOpen) f.Filters.Clear f.Filters.Add "Text documents", "*.txt" f.InitialFileName = "c:\" f.Show If f.SelectedItems.count > 0 Then MsgBox "file choose was " & f.SelectedItems(1) Else MsgBox "no file selected" End If And, you can also just select a folder by using: Set f = Application.FileDialog(msoFileDialogFolderPicker) |
#10
| |||
| |||
|
|
Rich is on the right track. You can use: Dim f As FileDialog |
![]() |
| Thread Tools | |
| Display Modes | |
| |