Hallo,
csv ist keine Variante, sondern da kommt exakt die selbe Datei heraus, lediglich mit der Dateiendung csv.
Aber egal. Natürlich geht das:
Sub exportToSMP()
Dim i As Long, j As Long, lastRow As Long, lastcol As Long, rLastRow As Range
Dim strRow As String, FF As Integer
const strFileName as string = "c:\toller\Pfad\Mit\Dateiname.smp"
With Worksheets("Export")
Set rLastRow = .Cells.Find("*", , xlValues, xlWhole, xlByRows, xlPrevious)
If Not rLastRow Is Nothing Then
lastRow = rLastRow.Row
lastcol = .Cells.Find("*", , xlValues, xlWhole, xlByColumns, xlPrevious).Column
FF = FreeFile()
Open strFileName For Output As #FF
For i = 1 To lastRow
strRow = ""
For j = 1 To lastcol
strRow = strRow & .Cells(i, j) & ";"
Next
strRow = Left(strRow, Len(strRow) - 1)
Print #FF, strRow
Next
Close #FF
End If
End With
End Sub
Grüße, Ulrich
|