Quantcast
Channel: DIAdem topics
Viewing all articles
Browse latest Browse all 3197

Select multiple folders and store in array: type changes from folder object to string?

$
0
0

Hi,

 

I am trying to implement the following:

 

The user selects a folder (which contains subfolders) in a dialog:

 

Set Dateiauswahl = CreateObject("Shell.Application").BrowseForFolder(0,"Verzeichnis auswählen",512,mess_path)

Set Ordner = CreateObject("Scripting.FileSystemObject").GetFolder(Dateiauswahl.Self.Path)

 

All subfolders in the selected folders are listed in two global array variables:

 

Call GlobalDim("FolderList("&Ordner.SubFolders.Count - 1&")")

Call GlobalDim("FolderPaths("&Ordner.SubFolders.Count - 1&")")
     

f=0
for each Unterordner in Ordner.SubFolders
    FolderList(f) = Unterordner.Name
    FolderPaths(f) = Unterordner
    f=f+1

next

 

Later on, only the files from some of the subfolders should be stored in another array FileList:

 

f=0
    for q=0 to UBound(auswahl)
       Unterordner = FolderPaths(auswahl(q))
       Call MsgBox(Unterordner)
       For Each File In Unterordner.Files
           if instr(1,File.Name,"Speed")=0 then
               FileList(f)= File.Path
               f=f+1
           end if
       Next

next

 

Now I seem to have a problem with the type of the data that is stored in the FolderPaths array. While Unterordner is a Folder Object, and needs to be a Folder Object for For Each File In Unterordner.Files to work, storing it in the array turns it into a string variable.

I don't really understand why, and am looking for a solution so that I can extract single subfolders from the FolderPaths array and then extract their files.


Viewing all articles
Browse latest Browse all 3197

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>