Hi folks,
I'm trying to add a True/False Boolean to a Check File Exists script that I've been useing.
Basically if the Boolean is True I'm checking the existance of 2 files, otherwise just the one.
I've been playing about trying to set up an If statement within the script but the cycles seem to be causing problems.
With the below code I'm getting Compile Error; Duplicate Declaration in Current Scope.
Any suggestions on the best way to get around this?
I want to try avoid having the If statement call a seperate Sub.
Sub CheckFilesExistDPD60(Send60Monthly)
If Send60Monthly = True Then
Dim filepaths(100) As Variant
filepaths(1) = DPD60NAMA
filepaths(2) = DPD60NAMA
'Loop
For I = 1 To 2 'Or filepaths(i) = ""
If Len(Dir(filepaths(I))) > 0 Then
Else: MsgBox ("file not found" & filepaths(I))
End
Exit For
End If
Next I
Else
Dim filepaths(100) As Variant <------Compile Error Here
filepaths(1) = DPD60NAMA
'Loop
For I = 1 To 1 'Or filepaths(i) = ""
If Len(Dir(filepaths(I))) > 0 Then
Else: MsgBox ("file not found" & filepaths(I))
End
Exit For
End If
Next I
End If
End Sub
Bookmarks