ich möchte eine Registerkarte per Knopfdruck auf einen Button (Steuerelement) in eine neue Datei im Ordner C:\Temp speichern. Anbei der Code zum Speichern im txt-Format. Kann man diese auf das Ausgabeformat csv modifizieren? Bin für jede Hilfe dankbar.
Gruß Herbert
Dim strSep As String, strDat As String, _
iCols As Byte, iRows As Integer, _
iR As Long, strTxt As String, strTmp, _
strPfad As String
strPfad = "c:\temp\"
Reset
With ActiveSheet
iRows = .UsedRange.Rows.Count
iCols = .UsedRange.Columns.Count
strSep = Chr(9)
strDat = strPfad & ActiveSheet.Name & ".txt"
Open strDat For Output As #1
For iR = 1 To iRows
strTmp = .Range(.Cells(iR, 1), .Cells(iR, iCols))
strTmp = WorksheetFunction.Transpose(WorksheetFunction.Transpose(strTmp))
strTxt = Join(strTmp, strSep)
Print #1, strTxt
Next iR
Close #1
End With