I think this works.
It writes directly to a .txt file (overwriting if it exists!):
Option Explicit
Sub testme()
Dim iRow As Long
Dim FirstRow As Long
Dim LastRow As Long
Dim wks As Worksheet
Dim myFileName As String
Dim FileNum As Long
Dim iCol As Long
Dim jCol As Long
Dim myStr As String
myFileName = "C:\my documents\excel\outfile.txt"
FileNum = FreeFile
Close FileNum
Open myFileName For Output As FileNum
Set wks = Worksheets("sheet1")
With wks
FirstRow = 2 'avoid header row
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
For iRow = FirstRow To LastRow
Print #FileNum, "writei2c"
myStr = "w1,(%"
For iCol = 1 To 48 Step 8
For jCol = 0 To 7
myStr = myStr & .Cells(iRow, iCol).Offset(0, jCol)
Next jCol
myStr = myStr & ",%"
Next iCol
myStr = Left(myStr, Len(myStr) - 2) & ")"
Print #FileNum, myStr
Print #FileNum, "GoSub nextpos"
Next iRow
End With
Close FileNum
End Sub
I got this with my test data (not just 0/1's):
writei2c
w1,(%12345678,%abcdefgh,%12345678,%abcdefgh,%12345678,%abcdefgh)
GoSub nextpos
writei2c
w1,(%12345678,%abcdefgh,%12345678,%abcdefgh,%12345678,%abcdefgh)
GoSub nextpos