Matrox
01-16-2007, 09:11 AM
Hi Guys,
Here I am again asking for your help.
I have in my code the excel sheets are in subfolders like:
c:\work\temp
\SubDir Grp_A
\SubDir GRP_A_APP\ "APP_xls files"
\SubDir GRP_A_PAM\ "PAM_xls files"
c:\work\temp
\SubDir Grp_B
\SubDir GRP_B_APP\ "APP_xls files"
\SubDir GRP_B_PAM\ "PAM_xls files"
I made one VBA code to each Grp,APP and PAm (same code n changing Private Const ctPathXLS = "c:\work\temp\SubDir Grp_X\SubDir GRP_X_XXX\".
How can I have it open the SubFolders to extract the datas from the excel in every folder by group, (APP,PAM) for example?
I specify tried this as I saw at this forum
Sub TryThis()
ShowAllFilesAllFoldersIn ("C:\work\temp")
End Sub
---
Sub ShowAllFilesAllFoldersIn(FolderPath)
Dim FolderFound As Object, File As Object
For Each FolderFound In CreateObject("Scripting.FileSystemObject") _
.GetFolder(FolderPath).SubFolders
Debug.Print FolderFound.Name
If Not FolderFound.Files.Count = 0 Then
For Each File In FolderFound.Files
If File.Name Like "*.xls" Then
'do what you want with the file here
Debug.Print vbTab & File.Name
End If
Next
End If
Next
But it didnt work:banghead: , that it can't find the others Subs and files name
is there anywhere around this
Once again, I hope to have any lights of you guys
Thanks in advance.
Ivan
Here I am again asking for your help.
I have in my code the excel sheets are in subfolders like:
c:\work\temp
\SubDir Grp_A
\SubDir GRP_A_APP\ "APP_xls files"
\SubDir GRP_A_PAM\ "PAM_xls files"
c:\work\temp
\SubDir Grp_B
\SubDir GRP_B_APP\ "APP_xls files"
\SubDir GRP_B_PAM\ "PAM_xls files"
I made one VBA code to each Grp,APP and PAm (same code n changing Private Const ctPathXLS = "c:\work\temp\SubDir Grp_X\SubDir GRP_X_XXX\".
How can I have it open the SubFolders to extract the datas from the excel in every folder by group, (APP,PAM) for example?
I specify tried this as I saw at this forum
Sub TryThis()
ShowAllFilesAllFoldersIn ("C:\work\temp")
End Sub
---
Sub ShowAllFilesAllFoldersIn(FolderPath)
Dim FolderFound As Object, File As Object
For Each FolderFound In CreateObject("Scripting.FileSystemObject") _
.GetFolder(FolderPath).SubFolders
Debug.Print FolderFound.Name
If Not FolderFound.Files.Count = 0 Then
For Each File In FolderFound.Files
If File.Name Like "*.xls" Then
'do what you want with the file here
Debug.Print vbTab & File.Name
End If
Next
End If
Next
But it didnt work:banghead: , that it can't find the others Subs and files name
is there anywhere around this
Once again, I hope to have any lights of you guys
Thanks in advance.
Ivan