Skip to content

Instantly share code, notes, and snippets.

Last active Mar 4, 2018
What would you like to do?
'Autocad LTや互換CADで使うSCRファイルを生成します。
Private Const START_CELL = "B2"
Private Const TemplateFileName = "\cad-script-template.txt"
Private Const OutputFileName = "\output-cad-script.scr"
Sub main()
Dim Cell As Range
Dim t As MiniTemplator
Set t = New MiniTemplator
t.ReadTemplateFromFile ThisWorkbook.Path & TemplateFileName
Dim rng As Range
set rng = Range("B2", "B3")
If WorksheetFunction.CountA(rng) = 0 Then
 MsgBox "ファイルパスが未入力です。入力して下さい。"
Set Cell = Range(START_CELL)
Do until Cell.Value = ""
t.SetVariable "file", Cell.Value
If Cell.Value Like "*A3*" Then
t.SetVariable "ver", "2000"
ElseIf Cell.Value Like "*A4*" Then
t.SetVariable "ver", "2013"
t.SetVariable "ver", "2000"
End If
t.AddBlock "scr"
Set Cell = Cell.offset(1,0)
t.GenerateOutputToFile ThisWorkbook.Path & OutputFileName
MsgBox "スクリプト生成成功"
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment