var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: HELP!! Using Findfile function!!??
Hello there folks
I'm kinda totally newbie using both Access and VB.
My knowlege in programming is somehow restricted to
C, C++, Pascal, Delphi and Old and good QuickBasic :-)
So, I'm feeling a little lost inside Access' modules, macros,
tables, forms and so on.
What I need is something like described below:
- Use some Findfile function to return a list of
existing files inside some given path, using some kind
of wildcards (*.txt or *.*)
When searching Access' help files I figured out this function:
But I don't know how to use it, as every time I compil it, I
get errors like "Invalid property use" (i actually translated it
from portuguse-BR, so it may differ from current english message)
Could anyone help me with this? I think its kind of really easy
to you non-newbie VB programmers to figure this out.
The SUB I have done which is spotting that error is the following:
Private Sub MyListFiles()
Dim i As Integer
Application.LookIn = "C:\Anypath"
Application.SearchSubFolders = False
Application.FileName = "*.txt"
Application.MatchAllWordForms = True
Application.FileType = msoFileTypeAllFiles
If Application.Execute() > 0 Then
MsgBox "Found " & .FoundFiles.Count & _
" file(s) int this path."
For i = 1 To Application.FoundFiles.Count
'Here, each file is found would be inserted into a Listbox,
'but it is not the problem, as I know how to do it.
MsgBox "No file found."
Other error I am coming with is about the msoFileTypeAllFiles CONSTANT,
which it does not recognize and I dont know if it is requesting a LIB to be
declared or what should it be and how to declare it....
I have had problems with FileSearch in the past. I use Dir().
To look for a file with or without a wildcard:
Dim strFilename as string
strFilename = Dir("C:\Program Files\*.exe")
This statement returns the first filename matching the wildcard. If there are no files that match it returns and empty string.
To get all of the files that match you need to loop:
Do While strFilename <> ""