Extended function available for Application.FileDialog(msoFileDialogFolderPicker)?
Hello everybody,
Is anybody aware of the following; is it possible to use the above mentioned folder picker function which will also includes all sub folders of the selected directory.
The issue is I would like to scan a special folder including all sub folders regarding doc and docx files which are stored in all those directories.
Among other things I tried to use the application.filesearch function as well - but unfortunately without any success up to now.
Can anybody advise?
Cheers
Joey
Re: Extended function available for Application.FileDialog(msoFileDialogFolderPicker)
I'm guessing you are using some form of VBA (Excel, Access, etc) rather than VB6, so I'm moving your thread to Office Development. :)
Re: Extended function available for Application.FileDialog(msoFileDialogFolderPicker)
Quote:
Originally Posted by
Hack
I'm guessing you are using some form of VBA (Excel, Access, etc) rather than VB6, so I'm moving your thread to Office Development. :)
You are right - Thanks and sorry!
Re: Extended function available for Application.FileDialog(msoFileDialogFolderPicker)
see examples from the help files
vb Code:
Set fs = Application.FileSearch
With fs
.LookIn = "C:\test"
.SearchSubFolders = True
.Filename = ".doc*"
.MatchTextExactly = True
.FileType = msoFileTypeAllFiles
.Execute
End With
all files with extention starting doc will be found in test and all subfolders, loop through fs.foundfiles
For I = 1 To fs.FoundFiles.Count
Re: Extended function available for Application.FileDialog(msoFileDialogFolderPicker)
Hi Pete,
Thanks for your reply. Do you see any chance to use the Application.FileDialog(msoFileDialogFolderPicker) function with a '.searchSUBfolder function?'
cheers
Joey
Re: Extended function available for Application.FileDialog(msoFileDialogFolderPicker)
i don't see it as application.filedialog is not available in my version of office,
msoFileDialogFolderPicker is not a valid constant for me
filesearch returns all files from subfolders if set to do so, if you want a folder picker i would use shbrowseforfolder, which can display files, but only folders can be selected
Re: Extended function available for Application.FileDialog(msoFileDialogFolderPicker)
Quote:
Originally Posted by
westconn1
i don't see it as application.filedialog is not available in my version of office,
msoFileDialogFolderPicker is not a valid constant for me
filesearch returns all files from subfolders if set to do so, if you want a folder picker i would use shbrowseforfolder, which can display files, but only folders can be selected
Hi Pete,
I would like to use this code.
Code:
Dim d As Document, t As Table, b As Border
Dim docnames As String, fnd As Boolean, maypath As String, fname As String
mypath = "c:\test\"
fname = Dir(mypath & "*.doc?")
Do While Len(fname) > 0
Set d = Documents.Open(mypath & fname)
fnd = False
For Each t In d.Tables
For Each b In t.Borders
If b.LineStyle = wdLineStyleDot Then
docnames = docnames & d.Name & vbNewLine: fnd = True: Exit For
End If
Next
If fnd Then Exit For
Next
fname = Dir
Loop
Regarding the mypath VAR I´m currently using the Application.FileDialog folder picker function to get the folder path which should be scanned. Now I´m really struggling related to the sub folders, I just thought I can do something like that...
Code:
Public Sub Search(Path As String)
Dim fld As Folder, Subfld As Folder, fleFile As File
Set fld = fso.GetFolder(Path)
For Each Subfld In fld.SubFolders
Search Subfld.Path
Next
Label1.Caption = "Search in" & fld.Path
For Each fleFile In fld.Files
If fso.GetExtensionName(fleFile.Name) = "doc" Then
Chkdotted_table
End If
Next
DoEvents
End Sub
but it doesn´t work. Do you have any hint for me how to check every doc file (in every folder) if these doc files include dotted tables?
Thanks for your support
Re: Extended function available for Application.FileDialog(msoFileDialogFolderPicker)
search in this or vb6 forum for recursive dir or recursive fso, there will be several examples
http://www.vbforums.com/showthread.p...ight=recursive
application.filesearch will do it all for you, without the recursive function