質問編集履歴

1

コードに漏れがありました

2018/10/18 05:27

投稿

MitsuhiroN
MitsuhiroN

スコア12

test CHANGED
File without changes
test CHANGED
@@ -192,6 +192,118 @@
192
192
 
193
193
  End Sub
194
194
 
195
+
196
+
197
+
198
+
199
+ Private Sub pasteSpecFiles(ByRef col_file As Collection)
200
+
201
+ Dim startLine As Long
202
+
203
+ Dim F As file
204
+
205
+
206
+
207
+ With allFiles
208
+
209
+ startLine = .Cells(.Rows.count, allFilesSh.絶対パス).End(xlUp).Row
210
+
211
+
212
+
213
+ For i = 1 To col_file.count
214
+
215
+ Set F = col_file.Item(i)
216
+
217
+ .Cells(startLine + i, allFilesSh.絶対パス).Value = F.path
218
+
219
+ .Cells(startLine + i, allFilesSh.フォルダ).Value = F.parentFolder
220
+
221
+ .Cells(startLine + i, allFilesSh.ファイル名).Value = F.Name
222
+
223
+ Set F = Nothing
224
+
225
+ Next
226
+
227
+ End With
228
+
229
+ End Sub
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+ Private Function compareBothCollection(ByRef colfiles As Collection) As Collection
238
+
239
+
240
+
241
+ Dim bufColfile As New Collection
242
+
243
+ Dim fl As file
244
+
245
+ Dim fl2 As file
246
+
247
+ Dim i As Long, j As Long
248
+
249
+
250
+
251
+ Set bufColfile = colfiles
252
+
253
+
254
+
255
+ For i = 1 To colfiles.count
256
+
257
+ For j = 1 To bufColfile.count
258
+
259
+ Set fl = colfiles(i)
260
+
261
+ Set fl2 = bufColfile(j)
262
+
263
+
264
+
265
+ If fl.Name = fl2.Name Then
266
+
267
+ If fl.DateLastModified < fl2.DateLastModified Then
268
+
269
+ colfiles.Remove (i)
270
+
271
+ Else: GoTo Skip
272
+
273
+ End If
274
+
275
+ Else: GoTo Skip
276
+
277
+ End If
278
+
279
+ Skip:
280
+
281
+ Set fi = Nothing
282
+
283
+ Set fl2 = Nothing
284
+
285
+ Next
286
+
287
+ Next
288
+
289
+ Set compareBothCollection = colfiles
290
+
291
+
292
+
293
+ End Function
294
+
295
+
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+
195
307
  ```
196
308
 
197
309