ciao
Vorrei sapere come faccio ad aprire una cartella e leggere i nomi delle sotto cartelle.
ciao
Vorrei sapere come faccio ad aprire una cartella e leggere i nomi delle sotto cartelle.
Ok ho trovato come fare ma mi apre la cartella e mi legge solo la prima cartella come faccio per fargli leggere tutti i nomi delle cartelle
Dim Folderspec As String
Folderspec = "C:\Programmi\IMGView\CDROM\WindowsImage"
Dim fs, f, f1, s, sf, d
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Folderspec)
Set sf = f.SubFolders
For Each f1 In sf
s = f1.Name
label1.Caption = s
Next
Ho provato con
Dim Folderspec As String
Folderspec = "C:\Programmi\IMGView\CDROM\WindowsImage"
Dim fs, f, f1, s, sf, d
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Folderspec)
Set sf = f.SubFolders
For Each f1 In sf
d.listindex = piu
piu = 1
s = f1.Name
label1.Caption = s
Next
ma non funziona si accetta tutti i sugerimenti grazie
ok risolto grazie
Dim Folderspec As String
Dim x As String
Folderspec = "C:\Programmi\IMGView\CDROM\WindowsImage\"
Dim fs, f, f1, s, sf, d
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(Folderspec)
Set sf = f.SubFolders
x = 0
For Each f1 In sf
s = f1.Name
Label1(x).Caption = s
x = x + 1
Next
volevo chiedere una cosa a tutti, è meglio richiamare l' oggetto "FSO" per fare ciò, oppure utilizzare la funzione DIR() ????
jabjoint
per me la funzione dir() è più veloce essendo "intrinseca" a VB. inoltre non devi istanziare altri oggetti..
![]()
![]()