Sub ParseToArray(sLine As String, A() As String)
Dim P As Long, MaxPos As Long, I As Long
P = InStr(sLine, ":") ' *** Informe aqui o delimitador (neste caso é ":")
Do While P
A(I) = Mid$(sLine, MaxPos + 1, P - MaxPos - 1)
MaxPos = P
I = I + 1
P = InStr(MaxPos + 1, sLine, ":", vbBinaryCompare)
Loop
A(I) = Mid$(sLine, MaxPos + 1)
End Sub
Private Sub ImportarTexto()
Dim F As Long, sLine As String, A(0 To 4) As String
Dim db As Database, rs As Recordset
On Error GoTo trata_erro
F = FreeFile
Open ArquivoTexto For Input As F
Set db = DBEngine(0).OpenDatabase(Banco.mdb)
On Error Resume Next
db.Execute "DROP TABLE Cnisa"
db.Execute "CREATE TABLE Tabela ([Desc] TEXT (100), " _
& "Valor TEXT (100))"
Set rs = db.OpenRecordset("Tabela", dbOpenTable)
Do While Not EOF(F)
Line Input #F, sLine
ParseToArray sLine, A()
rs.AddNew
rs(0) = A(0)
rs(1) = A(1)
rs.Update
Loop
'MsgBox "Arquivo texto importado com sucesso !! "
rs.Close
db.Close
Set db = Nothing
Close #F
Exit Sub
trata_erro:
MsgBox "Ocorreu o erro ==> " & Err.Description
End Sub