VBA

Sub SaveDTCCfgAsJava()

Dim Cfg() As String

Prj_DTCCfg_Path = Sheet4.Cells(1, 2)
TSECaseGeneratorRessourcesPath = Sheet4.Cells(2, 2)
Generate_TSECaseGeneratorRessources = Sheet4.Cells(3, 2)
MainLib_Path = Sheet4.Cells(4, 2)
Database_Path = Sheet4.Cells(5, 2)
Specification_Path = Sheet4.Cells(6, 2)
MainLib_Name = Sheet4.Cells(7, 2)

MainLib_Path = Replace(MainLib_Path, “”, “\”)
Database_Path = Replace(Database_Path, “”, “\”)
Specification_Path = Replace(Specification_Path, “”, “\”)

Prj_DTCCfgFile = Prj_DTCCfg_Path & “” & “Prj_DTCCfg.java”
TSECaseGeneratorRessourcesFile = TSECaseGeneratorRessourcesPath & “\TSECaseGeneratorRessources.properties”

'set and open file for output
fnum = FreeFile()
Open Prj_DTCCfgFile For Output As fnum
'write project info and then a blank line. Note the comma is required
Print #fnum, “package prjUtils;”;
Write #fnum,
Write #fnum,
Write #fnum,
Write #fnum,

Print #fnum, “public class Prj_DTCCfg”

Print #fnum, “{”
Write #fnum,
Print #fnum, " /*************************************************************************"
Print #fnum, " * Configuration Parameters Extracted from Project Specification"
Print #fnum, " *************************************************************************/"
Write #fnum,
Write #fnum,
'Rest the Txt string
TXT = “”

Print #fnum, “/* ---------- Sensors DTCs index ------------ */”
Write #fnum,
number_of_columns = 0
col_index = 1
row_index = 1 'rest row_index
TXT = “final public static String [] SensorsFailuresDTCIndex_Table = {”

Do Until Sheet9.Cells(row_index, col_index).Value = “”

If Sheet9.Cells(row_index, col_index + 1).Value = "" Then
      TXT = TXT + """" + Sheet9.Cells(row_index, col_index).Value + """" + "};"
Else
      TXT = TXT + """" + Sheet9.Cells(row_index, col_index).Value + """" + " ,"
End If

number_of_columns = number_of_columns + 1
col_index = col_index + 1

Loop
'TXT = TXT + “};”
Print #fnum, TXT
Write #fnum,

'Rest the Txt string
TXT = “”

Print #fnum, “/* ---------- Sensors DTCs ------------ */”
Write #fnum,
row_index = 2 'rest row_index
TXT = “final public static String [][] SensorsFailuresDTC_Table = { {”

Do Until Sheet9.Cells(row_index, 1).Value = “”
col_index = 1
Do Until Sheet9.Cells(row_index, col_index).Value = “”
'MsgBox “”"" + Sheet1.Cells(row_index, col_index).Value + “”""
'Write #fnum, “” + Sheet1.Cells(row_index, col_index).Value + “”

If Sheet9.Cells(row_index, col_index + 1).Value = "" Then
      TXT = TXT + """" + Sheet9.Cells(row_index, col_index).Value + """" + "}" + Chr(10)
Else
      TXT = TXT + """" + Sheet9.Cells(row_index, col_index).Value + """" + " ,"
End If
            
col_index = col_index + 1
Loop

row_index = row_index + 1

If Sheet9.Cells(row_index, 1).Value <> "" Then
      TXT = TXT + ",{"
End If

Loop

TXT = TXT + “};”

Print #fnum, TXT
Write #fnum,

'Rest the Txt string
TXT = “”

Print #fnum, “/* ---------- Sensors DTCs 2 index ------------ */”
Write #fnum,
number_of_columns = 0
col_index = 1
row_index = 1 'rest row_index
TXT = “final public static String [] PowerSupplyFailuresDTCIndex_Table = {”

Do Until Sheet11.Cells(row_index, col_index).Value = “”

If Sheet11.Cells(row_index, col_index + 1).Value = "" Then
      TXT = TXT + """" + Sheet11.Cells(row_index, col_index).Value + """" + "};"
Else
      TXT = TXT + """" + Sheet11.Cells(row_index, col_index).Value + """" + " ,"
End If

number_of_columns = number_of_columns + 1
col_index = col_index + 1

Loop
'TXT = TXT + “};”
Print #fnum, TXT
Write #fnum,

'Rest the Txt string
TXT = “”

Print #fnum, “/* ---------- Sensors DTCs 2 ------------ */”
Write #fnum,
row_index = 2 'rest row_index
TXT = “final public static String [][] PowerSupply_FailuresDTC_Table = { {”

Do Until Sheet11.Cells(row_index, 1).Value = “”
col_index = 1
Do Until Sheet11.Cells(row_index, col_index).Value = “”
'MsgBox “”"" + Sheet1.Cells(row_index, col_index).Value + “”""
'Write #fnum, “” + Sheet1.Cells(row_index, col_index).Value + “”

If Sheet11.Cells(row_index, col_index + 1).Value = "" Then
      TXT = TXT + """" + Sheet11.Cells(row_index, col_index).Value + """" + "}" + Chr(10)
Else
      TXT = TXT + """" + Sheet11.Cells(row_index, col_index).Value + """" + " ,"
End If
            
col_index = col_index + 1
Loop

row_index = row_index + 1

If Sheet11.Cells(row_index, 1).Value <> "" Then
      TXT = TXT + ",{"
End If

Loop

TXT = TXT + “};”

Print #fnum, TXT
Write #fnum,

Print #fnum, “/* ---------- LED DTCs index ------------ */”
Write #fnum,
number_of_columns = 0
col_index = 1
row_index = 1 'rest row_index
TXT = “final public static String [] LEDFailuresDTCIndex_Table = {”

Do Until Sheet13.Cells(row_index, col_index).Value = “”

If Sheet13.Cells(row_index, col_index + 1).Value = "" Then
      TXT = TXT + """" + Sheet13.Cells(row_index, col_index).Value + """" + "};"
Else
      TXT = TXT + """" + Sheet13.Cells(row_index, col_index).Value + """" + " ,"
End If

number_of_columns = number_of_columns + 1
col_index = col_index + 1

Loop
'TXT = TXT + “};”
Print #fnum, TXT
Write #fnum,

'Rest the Txt string
TXT = “”
row_index = 2 'rest row_index
Print #fnum, “/* ---------- LED DTCs ------------ */”
Write #fnum,

TXT = “final public static String [][] LEDFailuresDTC_Table = {”
Print #fnum, TXT

Do Until Sheet13.Cells(row_index, 1).Value = “”
col_index = 1
TXT = “{”
Do Until Sheet13.Cells(row_index, col_index).Value = “”
If Sheet13.Cells(row_index, col_index + 1).Value = “” Then
TXT = TXT + “”"" + Sheet13.Cells(row_index, col_index).Value + “”"" + “},”
Else
TXT = TXT + “”"" + Sheet13.Cells(row_index, col_index).Value + “”"" + " ,"
End If

        col_index = col_index + 1
            
   
     Loop
     Print #fnum, TXT


row_index = row_index + 1

Loop

TXT = “};”

Print #fnum, TXT
Write #fnum,

'Rest the Txt string
TXT = “”

Print #fnum, “/* ----------P4U Switch DTCs index ------------ */”
Write #fnum,
number_of_columns = 0
col_index = 1
row_index = 1 'rest row_index
TXT = “final public static String [] P4U_SwitchFailuresDTCIndex_Table = {”

Do Until Sheet12.Cells(row_index, col_index).Value = “”

If Sheet12.Cells(row_index, col_index + 1).Value = "" Then
      TXT = TXT + """" + Sheet12.Cells(row_index, col_index).Value + """" + "};"
Else
      TXT = TXT + """" + Sheet12.Cells(row_index, col_index).Value + """" + " ,"
End If

number_of_columns = number_of_columns + 1
col_index = col_index + 1

Loop
'TXT = TXT + “};”
Print #fnum, TXT
Write #fnum,

'Rest the Txt string
TXT = “”

row_index = 2 'rest row_index
Print #fnum, “/* ---------- P4U switch DTCs ------------ */”
Write #fnum,

TXT = “final public static String [][] P4U_SwitchFailuresDTC_Table = {”
Print #fnum, TXT

Do Until Sheet12.Cells(row_index,

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值