Hi,

I have an app which searches for all the MS Agent Characters on the pc and stores their names in an array, so I can load them later.
I have this code to add them to the array but it's not working:
The array AgentNames has been declared in General Declarations
Code:
Dim FSO As FileSystemObject
    Dim FSOFolder As Folder
    Dim FSOFile As File
    Dim sPath As String
        
    On Local Error Resume Next
    Set FSO = New FileSystemObject
    
    ' Load Characters into array
    sPath = FSO.GetSpecialFolder(WindowsFolder) & "\MSAgent\Chars\"
    If FSO.FolderExists(sPath) Then
        Set FSOFolder = FSO.GetFolder(sPath)
        lCount = 0
        For Each FSOFile In FSOFolder.Files
        ReDim Preserve AgentNames(UBound(AgentNames) + 1) As String
        AgentNames(lCount) = FSOFile.Name
        lCount = lCount + 1
        Next
    Else
        MsgBox "Error while loading characters!", vbOKOnly + vbCritical, "Error"
        Unload Me
    End If
When I want to scroll through the names with 'AgentNames(scrollindex), it gives an error.

Does anyone know what I should do?

Tnx in advance,

MK