Jw_cadの使い方について、入門から応用、自動作図まで解説します。
前回までで、jwc_temp.txt のデータをワークシートに代入しました。
今回はこれを編集します。
Private Sub Workbook_Open()
Dim editTEXTDATA
Dim myPath
Dim buf
Dim cnt As Long
Dim i As Long
Dim RowEnd As Long
myPath = ThisWorkbook.Path
editTEXTDATA = myPath & "\jwc_temp.txt"
cnt = 1
Open editTEXTDATA For Input As #1
Do
Line Input #1, buf
Worksheets(1).Cells(cnt, 1).Value = buf
cnt = cnt + 1
Loop Until EOF(1)
Close #1
With Worksheets(1)
.Cells(1, 1).EntireRow.Delete
RowEnd = .Range("A1").End(xlDown).Row
For i = 1 To RowEnd
If .Cells(i, 1) = "#" Then
.Cells(i, 1).EntireRow.Insert
.Cells(i, 1).Value = "0 0 100 100"
Exit For
End If
Next i
End With
End Sub
1行目のhqの削除と、直線のコードを追加します。
①1行目を削除します
②データが入っている最終行を取得して、最終行まで
ループを回します。
#があれば、1行挿入して、直線のコードを挿入します。
動画で解説しましたので、参考にして下さい。