On tuollainen makro, toiminee edelleen jos M$ Excel
Rem Attribute VBA_ModuleType=VBADocumentModule
Option VBASupport 1
Private Sub CommandButton1_Click()
Const DELIMITER As String = "|"
Dim myRecord As Range
Dim myField As Range
Dim nFileNum As Long
Dim sOut As String
nFileNum = FreeFile
Open "c:\temp\csv_with_real_data.csv" For Output As #nFileNum
For Each myRecord In Range("A1:A" & _
Range("A" & Rows.Count).End(xlUp).Row)
With myRecord
For Each myField In Range(.Cells, _
Cells(.Row, Columns.Count).End(xlToLeft))
sOut = sOut & DELIMITER & myField
Next myField
Print #nFileNum, "juoni|" & Mid(sOut, 2)
sOut = Empty
End With
Next myRecord
Close #nFileNum
MsgBox "File 'csv_with_real_data.csv' created in c:\temp"
End Sub
Miten muutan sen toimimaan myös OpenOfficessa (3.2)
Nojoo, tuon polun "c:\temp" voisi muuttaa järjelliseen malliin, esimerkiksi "/tmp/."