回答編集履歴

2

ソース修正

2019/10/11 03:48

投稿

YAmaGNZ
YAmaGNZ

スコア10469

test CHANGED
@@ -42,6 +42,8 @@
42
42
 
43
43
 
44
44
 
45
+ Set objInFile2 = objFso.OpenTextFile(Path & "\" & InFile2, 1, False)
46
+
45
47
  Do Until objInFile2.AtEndOfStream
46
48
 
47
49
  strInFileLine2 = Split(objInFile2.ReadLine, ",")
@@ -74,6 +76,8 @@
74
76
 
75
77
  Loop
76
78
 
79
+ objInFile2.Close
80
+
77
81
  objOutFile.WriteLine SYA_BG & "," & KINMU_DATE & "," & NUM_MAX
78
82
 
79
83
  Loop

1

追記

2019/10/11 03:48

投稿

YAmaGNZ
YAmaGNZ

スコア10469

test CHANGED
@@ -21,3 +21,63 @@
21
21
  ```
22
22
 
23
23
  とループごとに閉じて最初から読み込むようにすればよろしいかと思います。
24
+
25
+
26
+
27
+ 最終時刻を求める際に
28
+
29
+ ```VBS
30
+
31
+ Do Until objInFile.AtEndOfStream
32
+
33
+ strInFileLine = Split(objInFile.ReadLine, ",")
34
+
35
+ SYA_BG = strInFileLine(0)
36
+
37
+ KINMU_DATE = strInFileLine(1)
38
+
39
+
40
+
41
+ NUM_MAX = strInFileLine(2) '比較対象として初期化
42
+
43
+
44
+
45
+ Do Until objInFile2.AtEndOfStream
46
+
47
+ strInFileLine2 = Split(objInFile2.ReadLine, ",")
48
+
49
+ SYA_BG2 = strInFileLine2(0)
50
+
51
+ KINMU_DATE2 = strInFileLine2(1)
52
+
53
+ NUM(1) = strInFileLine2(2)
54
+
55
+ NUM(2) = strInFileLine2(3)
56
+
57
+ NUM(3) = strInFileLine2(4)
58
+
59
+ IF SYA_BG = SYA_BG2 AND KINMU_DATE = KINMU_DATE2 Then
60
+
61
+ for i = 1 to 3
62
+
63
+ if NUM_MAX < NUM(i) Then
64
+
65
+ NUM_MAX = NUM(i)
66
+
67
+ END IF
68
+
69
+ NEXT
70
+
71
+ END IF
72
+
73
+ 'TIME_1_1 = NUM_MAX '不要
74
+
75
+ Loop
76
+
77
+ objOutFile.WriteLine SYA_BG & "," & KINMU_DATE & "," & NUM_MAX
78
+
79
+ Loop
80
+
81
+ ```
82
+
83
+ と比較対象の初期化を行うほうがよろしいかと思います。