I'm trying to generate an array of worksheets and I'm getting an out of memory error when I try to add to the array - well, on another person's machine. My machine works just fine. The excel file is not large (it's 4mb), nor is it overly complicated. It has 10 worksheets and the array has 7 members once going through the following code:
Dim wsArray As New ArrayList
For wsi = 1 To Worksheets.Count
MsgBox "Checking " + Worksheets(wsi).Name
If IsNumeric(Left(Worksheets(wsi).Name, 2)) = True Then
MsgBox "Adding " & wsi & " - " + Worksheets(wsi).Name
'wsArray.Add Worksheets(wsi).Name
End If
Next
-- Background
I was doing a Set wsArray = CreateObject("System.Collections.ArrayList") but that was throwing an out of memory error and so now I've loaded the .dll on the other machine and we're now erroring out on the add line/for loop.
Thoughts?
the comment on the add line - that's uncommented out when I'm running it. Just troubleshooting things and is a copy/paste error.
Dim wsArray As New ArrayList
For wsi = 1 To Worksheets.Count
MsgBox "Checking " + Worksheets(wsi).Name
If IsNumeric(Left(Worksheets(wsi).Name, 2)) = True Then
MsgBox "Adding " & wsi & " - " + Worksheets(wsi).Name
'wsArray.Add Worksheets(wsi).Name
End If
Next
-- Background
I was doing a Set wsArray = CreateObject("System.Collections.ArrayList") but that was throwing an out of memory error and so now I've loaded the .dll on the other machine and we're now erroring out on the add line/for loop.
Thoughts?
the comment on the add line - that's uncommented out when I'm running it. Just troubleshooting things and is a copy/paste error.
Last edited by a moderator: