Moderatori: Anthony47, Flash30005
Sub Femix()
Dim txtFile As String, txtLine As String
Dim fFile As Long, myMatch, repStr As String
Dim WArr(), wInd As Long
'
txtFile = "D:\DDownloads\byFEMON_esempio_C10225.txt" '<<< Nome del file Txt
Sheets("Foglio1").Select '<<< Il foglio Excel coi dati
'
fFile = FreeFile
Open txtFile For Input As #fFile
ReDim WArr(1 To 1)
wInd = 1
While Not EOF(fFile)
Line Input #fFile, txtLine
cr18 = Left(txtLine, 18)
myMatch = Application.Match(cr18, Range("A:A"), False)
WArr(wInd) = txtLine
If Not IsError(myMatch) Then
repStr = Cells(myMatch, "B")
repStr = repStr & String(56 - Len(repStr), " ")
Mid(WArr(wInd), 19, 57) = repStr
End If
wInd = wInd + 1
ReDim Preserve WArr(1 To wInd)
Wend
Close #fFile
'
'Crea nuovo txt
Open txtFile For Output As #fFile
For i = 1 To wInd - 1
Print #fFile, WArr(i)
Next i
Close #fFile
End Sub
Probabilmente si: come hai personalizzato l'istruzione txtFile = "Drive:\Percorso\NomeFile" ?Grazie Anthony,
purtroppo la macro si ferma in questo punto:
Open txtFile For Input As #fFile
ho sbagliato qualcosa?
If Not IsError(myMatch) Then
repStr = Left(Cells(myMatch, "B"), 55) '****
repStr = repStr & String(56 - Len(repStr), " ")
Mid(WArr(wInd), 19, 57) = repStr
End If
Torna a Applicazioni Office Windows
Inserire dati filtrati da 2 file ad un terzo file Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 14 |
Inserire add.in nella barra di avvio veloce in excel 2003 Autore: Ricky0185 |
Forum: Applicazioni Office Windows Risposte: 4 |
Excel: problema con date se devo unirle a testi Autore: valle1975 |
Forum: Applicazioni Office Windows Risposte: 5 |
Visitano il forum: Nessuno e 11 ospiti