import from txt file

S

sal21

'EC DA CICSEA
Sub FLUSSI()
Workbooks("TABL0664.XLS").Activate
Sheets("L0664").Select

' Range("A3:O10000").Select
' Selection.ClearContents

'Aggiungi ' sotto
Range("a3").Select
Do Until ActiveCell = ""
ActiveCell.Offset(1, 0).Select
Loop
'Fine attacca sotto


Range("A3").Select
Close #1

Dim riga As String
Dim cont As Integer
Dim var_IMPP As String
Dim VAR_DATAP As String
Dim VAR_PARTP As String
Dim OPENfile As String

cont = 3

OPENfile = "E:\EPF\L0664AREA_132.EPF "

Open OPENfile For Input As #1

While Not EOF(1)

Line Input #1, riga

If Len(Trim(riga)) > 0 Then



If InStr(Mid(riga, 2, 24), "SPORTELLO :") > 0 Then
var_SPORT = Trim(Mid(riga, 15, 5))

If Not EOF(1) Then

Line Input #1, riga
Line Input #1, riga
End If
If InStr(Mid(riga, 2, 24), "PARTITA N.:") > 0 Then
VAR_PARTP = Trim(Mid(riga, 22, 8))
var_NOMIN = Trim(Mid(riga, 32, 30))
End If

Line Input #1, riga
Line Input #1, riga
Line Input #1, riga
Line Input #1, riga

If InStr(Mid(riga, 4, 1), "/") > 0 Then
var_CARIC = Trim(Mid(riga, 2, 10))
var_NUMEF = Trim(Mid(riga, 19, 10))
VAR_IMP = Trim(Mid(riga, 36, 14))
var_SCAD = Trim(Mid(riga, 53, 10))
var_BNL = Trim(Mid(riga, 67, 5))
var_CORR = Trim(Mid(riga, 79, 5))
var_DEB = Trim(Mid(riga, 94, 30))


End If



Foglio1.Range("A" & Trim(Str(cont))).Value = VAR_PARTP
Foglio1.Range("B" & Trim(Str(cont))).Value = var_SPORT
Foglio1.Range("C" & Trim(Str(cont))).Value = var_NOMIN
Foglio1.Range("D" & Trim(Str(cont))).Value = var_CARIC
Foglio1.Range("E" & Trim(Str(cont))).Value = var_NUMEF
Foglio1.Range("F" & Trim(Str(cont))).Value = VAR_IMP
Foglio1.Range("G" & Trim(Str(cont))).Value = var_SCAD
Foglio1.Range("H" & Trim(Str(cont))).Value = var_BNL
Foglio1.Range("I" & Trim(Str(cont))).Value = var_CORR
Foglio1.Range("J" & Trim(Str(cont))).Value = var_DEB

cont = cont + 1

End If
End If
Wend
Close #1
'Call ORDINA
'Call DUPLICATI
'Call ORDINA2
Range("A3").Select

MsgBox ("ELEBORAZIONE TERMINATA!")
End Sub



Here is a txt file:
http://www.gssitaly.com/l0664.zip

i want from this from the macro:
http://www.gssitaly.com/tabtext.zip

but i have this:
http://www.gssitaly.com/tab_no_good.zip

difficult to go on next rekord in txt file ...ARG!!!!!!!!!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top