There are a couple of mistakes you made:
a) array indexes start at 0 (except you have stated otherwise)
so you have to adress your singlefile() array differently.
Code:
op = True
singlefile(optime) = Text2.Text 'first set element 0
optime = optime + 1 'then increment counter
Also the for loop within Command2_Click() must start at 0
Code:
  Fo l=0 to optime-1
    ...
b) as you did not dim xlapp as an array, so xlapp(l) will invariably be an error. You could
Code:
 
  Dim xlapp() as Excel.Application
   ...
  For l = 0 to optime - 1
    ReDim xlapp(l)
    set xlapp(l) = openexcel(l, singlefile(l))
  Next
But this is only hinting the obvious technical errors. We do not know what you want to achieve exactly. Therefore there may be more flaws within your concept which are not as easy to spot.



optime = optime + 1