|
1 999G123456789
A1=1
A2=999G
A3=123456789
と指定してみましたが、1個目のデータが中途半端になります。
何か誤りありますか?
'*------------------------------------------------*
'* TXT形式変換サンプル *
'*------------------------------------------------*
Type recFormat
f1 As String * 10
f2 As String * 4
f3 As String * 12
End Type
Sub test()
Dim rFormat As recFormat
Dim fN As Integer
Dim myPath As String
Dim mArray
Dim i As Integer '整数型
fN = FreeFile
myPath = ThisWorkbook.Path
Open myPath & "\デガサンヨウ.dat" For Binary As #fN
mArray = Range("A1").CurrentRegion.Value
For i = 1 To UBound(mArray, 1)
rFormat.f1 = Format(Trim(mArray(i, 1)), "@@")
rFormat.f2 = Format(Trim(mArray(i, 2)), "@@")
rFormat.f3 = Format(Trim(mArray(i, 3)), "@@")
Put #fN, , rFormat
Put #fN, , vbCrLf
Next
Close #fN
End Sub
|
|