|
問題が色々有るので私は、使わないけど?
(忘れているので上手く行かなかったらゴメン)
構造体を使って、出力するならRandomモードで出力したら?
Option Explicit
Type KOUZOU '実際、要素の数は50〜100位あります
DKBN As String * 1
ID1 As String * 10
ID2 As String * 10
YMD As String * 8
RUN As String * 4
CrLf As String * 2 '追加
End Type
Public Sub Sample()
Dim My_Kouzou As KOUZOU
Dim TEXTFILE As String
Dim TXT As Integer
TEXTFILE = "D:\xxxxx.txt"
TXT = FreeFile
Open TEXTFILE For Random As #TXT Len = Len(KOUZOU)
With My_Kouzou
.CrLf = vbCrLf '追加
.DKBN = Trim(Sheet1.Range("A" & Iy).Value)
.ID1 = Trim(Sheet1.Range("B" & Iy).Value) & Space(2)
.ID2 = Trim(Sheet1.Range("C" & Iy).Value) & Space(5)
.YMD = Trim(Sheet1.Range("D" & Iy).Value)
.RUN = Trim(Sheet1.Range("E" & Iy).Value)
End With
Put #TXT, , My_Kouzou '← ココでエラーです
Close #TXT
End Sub
|
|