Marius '95
troubleShooter
Se da urmatorul cod:
Ce fac gresit?
LE:
Am izolat-o la:
Mentionez ca este vorba despre Excel 2003.
Code:
Dim CobasExportPath As String
Dim ImportLine As String
Dim Head1() As String
Dim Head2() As String
Dim Head() As String
Dim OldIndex As String
Dim I As Integer
CobasExportPath = Application.GetOpenFilename(, , "Fisierul exportat de Cobas 6000", "Importa")
Open CobasExportPath For Input As #1
Line Input #1, ImportLine
Head1 = Split(ImportLine, ",")
Line Input #1, ImportLine
Head2 = Split(ImportLine, ",")
OldIndex = ""
For I = 0 To UBound(Head2)
If Head1(I) = "" Then
Head1(I) = OldIndex
Else
OldIndex = Head1(I)
End If
Debug.Print Head1(I) 'Printeaza "" (string gol)
Debug.Print "|" 'Printeaza "|" (bara verticala)
Debug.Print Head1(I) & "|" 'Printeaza "|" (bara verticala)
Debug.Print Head1(I) & "|" & Head2(I) 'Printeaza "|RType_1" (bara verticala si ceva citit din fisier)
Head(I) = Head1(I) & "|" & Head2(I) 'Da eroare: Subscript out of range
Next I
For I = 0 To UBound(Head)
Debug.Print Head(I)
Next I
LE:
Am izolat-o la:
Code:
Dim Head1() As String
Head1(0) = "Tralala" 'Eroare: Subscript out of range