Gruppe
Allgemein
Problem
Die Werte aus Spalte A von Tabelle2 sollen in einer Textdatei im Verzeichnis "c:\temp" unter dem in Zelle A1 genannten Dateinamen gespeichert werden.
StandardModule: basMain
Sub SaveAsText()
Dim lRow As Long, lRowL As Long
Dim sPath As String
sPath = Application.DefaultFilePath & "\"
Close
Open sPath & Range("A1").Value For Output As #1
With Worksheets("Tabelle2")
lRowL = .Cells(Rows.Count, 1).End(xlUp).Row
For lRow = 1 To lRowL
Print #1, .Cells(lRow, 1).Text
Next lRow
End With
Close
MsgBox "Datei gespeichert unter " & _
sPath & Range("A1").Value
End Sub