Results 1 to 4 of 4

Duplicate Declaration in Current Scope

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-24-2010
    Location
    Dublin, Ireland
    MS-Off Ver
    Excel 2003
    Posts
    195

    Talking Duplicate Declaration in Current Scope

    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
    Last edited by TonyforVBA; 11-23-2011 at 08:24 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1