Gruppe
Extern
Problem
Die Zellinhalte aus Spalte A sollen jeweils in eine Textdatei gem. Dateinamen aus Spalte B gespeichert werden. Die Pfadangabe steht in Zelle E1.
StandardModule: basMain
Sub XLS2TXT()
Dim iRow As Integer
On Error GoTo ERRORHANDLER
iRow = 1
Close
Do Until IsEmpty(Cells(iRow, 1))
Open Range("E1").Value & "\" & _
Cells(iRow, 2) & ".txt" For Output As #1
Print #1, Cells(iRow, 1).Value
Close
iRow = iRow + 1
Loop
MsgBox "Die Dateien wurden angelegt!"
Exit Sub
ERRORHANDLER:
MsgBox "Die Dateien konnten nicht angelegt werden!"
End Sub