beim schreiben einer Textdatei möchte ich dem auszulesenden Inhalt
eine zusätzliche Spalte mit dem Usernamen hinzufügen.
Die Zeilenanzahl soll gleich der Zeilenanzahl des auszulesenden Inhaltes
sein.
Um die Ursprungstabelle nicht zu verändern, soll dies erst beim
schreiben der Textdatei geschehen.
Wer kann helfen?
Peter
Sub Export_TextDatei()
Dim intRow As Integer, intColCount As Integer, intCol As Integer
Dim strTmp As String
Dim strAnwender As String
strAnwender = Application.UserName
intRow = 1
Open "TestUser.txt" For Output As #1
' Columns(1).Insert
' Cells(intRow, 1) = strAnwender
Do Until IsEmpty(Cells(intRow, 1))
strTmp = ""
For intCol = 1 To intColCount
If strTmp <> "" Then
strTmp = strTmp & "," & Cells(intRow, intCol)
Else
strTmp = Cells(intRow, intCol)
End If
Next intCol
Print #1, strTmp
intRow = intRow + 1
Loop
Close
End Sub