|
-
Oct 1st, 2010, 08:32 AM
#1
Thread Starter
New Member
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
-
Oct 1st, 2010, 08:37 AM
#2
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.
-
Oct 1st, 2010, 08:42 AM
#3
Thread Starter
New Member
Re: Extended function available for Application.FileDialog(msoFileDialogFolderPicker)
 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!
-
Oct 1st, 2010, 04:19 PM
#4
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 4th, 2010, 07:28 AM
#5
Thread Starter
New Member
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
-
Oct 4th, 2010, 03:35 PM
#6
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
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 5th, 2010, 01:37 PM
#7
Thread Starter
New Member
Re: Extended function available for Application.FileDialog(msoFileDialogFolderPicker)
 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
-
Oct 5th, 2010, 03:21 PM
#8
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
Last edited by westconn1; Oct 5th, 2010 at 03:27 PM.
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|