
Sub Creafile()
Dim fs As Object
lr = Cells(Rows.Count, "J").End(xlUp).Row
Set fs = CreateObject("Scripting.FileSystemObject")
For riga = 2 To 3 'lr
nfile = "F" & Cells(riga, "I").Value & ".txt"
Set a = fs.createtextfile("C:Documenti" & nfile, True)
a.WriteLine Cells(riga, "J").Value
a.Close
Set a = Nothing
Next
MsgBox "Fatto"
Set fs = Nothing
End Sub |
Sub Creafile()
Dim fs As Object
lr = Cells(Rows.Count, "J").End(xlUp).Row
Set fs = CreateObject("Scripting.FileSystemObject")
For riga = 2 To lr
nfile = "F" & "_" & Cells(riga, "J").Value & ".txt"
Set a = fs.createtextfile("C:UsersAndreaDocumentsFILE" & nfile, True)
a.WriteLine Cells(riga, "J").Value
a.Close
Set a = Nothing
Next
MsgBox "Fatto"
Set fs = Nothing
End Sub |
