|
こんばんは。
ま、テキストに対して文字を書き込むだけだけなので、
速さとかこだわらなければごり押しのやりかたで書けば色々できますよ。
こんな感じのソースとか汚いソースですけど。
Sub OutPut()
Dim OutTxt As String
Dim x As Long
Dim y As Long
Dim free As Integer
y = 1
OutTxt = ""
With Sheets(1)
Do While .Cells(y, 1) <> "" 'セル行
If (OutTxt <> "") Then OutTxt = OutTxt & vbCrLf '改行
For x = 1 To 5 'セル列
If .Cells(y, x) <> "" And .Cells(y, x + 1) <> "" Then
OutTxt = OutTxt & """" & .Cells(y, x) & """" & "@"
Else
OutTxt = OutTxt & """" & .Cells(y, x) & """"
End If
Next x
OutTxt = OutTxt & "<CR>"
y = y + 1
Loop
End With
free = FreeFile
Open "C:\OutPut.csv" For Output As #free
Print #free, OutTxt
Close #free
End Sub
|
|