-
[RESOLVED] Array Q
I'm on a roll here so bear with me...
In amking an array, the array needs to be DIMMed prior to filling. Using this code I can count all the drives, but I want to put the drive letters in an array.
<code>
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colDrives = objFSO.Drives
i=0
For Each objDrive in colDrives
i=i+1
Next
i=int(i)
dim Xdrive(i)
</code>
when the code reaches the DIM statement, it fails saying it needs an integer. I tried to change the value from Csng to INT, but it still fails.
Any ideas guys?
-
Re: Array Q
Ok got it. I made a dynamic array instead.
-
Re: [RESOLVED] Array Q
Code not tested.But will work
Code:
Dim i
Dim drvs() 'For storing the drivename
i=0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colDrives = objFSO.Drives
For Each objDrive in colDrives
i=i+1
drvs(i)=objDrive.Name 'Store the drive name
Next