I could use some suggestions here.
What I am trying to do is set up a loop that will check to see if these files exist. Rather than hardcode these files into an If...Then logic fest. The loop below is supposed to check and see if a file exists starting with TargetFile4 and working down to TargetFile0. The "& i" idea does not work and I'm wondering if something can make this work.
TargetFile0 = "c:\asrunimp\asrunimp.log"
TargetFile1 = "c:\asrunimp\asrunimp1d.log"
TargetFile2 = "c:\asrunimp\asrunimp2d.log"
TargetFile3 = "c:\asrunimp\asrunimp3d.log"
TargetFile4 = "c:\asrunimp\asrunimp4d.log"
For i = 4 to 0 Step -1
If fso.fileexists(TargetFile & i) Then ...
What I am trying to do is set up a loop that will check to see if these files exist. Rather than hardcode these files into an If...Then logic fest. The loop below is supposed to check and see if a file exists starting with TargetFile4 and working down to TargetFile0. The "& i" idea does not work and I'm wondering if something can make this work.
TargetFile0 = "c:\asrunimp\asrunimp.log"
TargetFile1 = "c:\asrunimp\asrunimp1d.log"
TargetFile2 = "c:\asrunimp\asrunimp2d.log"
TargetFile3 = "c:\asrunimp\asrunimp3d.log"
TargetFile4 = "c:\asrunimp\asrunimp4d.log"
For i = 4 to 0 Step -1
If fso.fileexists(TargetFile & i) Then ...