|
▼超初心者 さん:
▼ichinose さん:
下のような感じでよろしいでしょうか?よろしくお願いします。
Sub main2()
Dim idx As Long
Dim myPath As String
Dim N As Integer
Dim myarray As Variant
myPath = ThisWorkbook.Path & "\test.csv"
N = FreeFile
Open myPath For Output As #N
For idx = 1 To 5
With Worksheets("test" & idx)
myarray = Application.Transpose(Application.Transpose( _
.Range(.Cells(1, 1), .Cells(1, .Columns.Count).End(xlToLeft)).Value))
End With
If TypeName(myarray) <> "Variant()" Then
'配列でない場合、強制的に配列を作成する
myarray = Array(myarray)
End If
Print #N, Join(myarray, ",")
Next
k = 1
Do While Cells(k, 1) > "1"
With Worksheets("test6")
myarray = Application.Transpose(Application.Transpose( _
.Range(.Cells(k, 1), .Cells(k, .Columns.Count).End(xlToLeft)).Value))
End With
If TypeName(myarray) <> "Variant()" Then
'配列でない場合、強制的に配列を作成する
myarray = Array(myarray)
End If
Print #N, Join(myarray, ",")
k = k + 1
Loop
Close #N
Call 社保提出FD作成メッセージ
End Sub
|
|