Results 1 to 7 of 7

Macro to check file exists and take input from the file

Threaded View

naidu9295 Macro to check file exists... 06-11-2010, 04:12 AM
naidu9295 Re: Macro to check file... 06-12-2010, 05:10 AM
pike Re: Macro to check file... 06-12-2010, 05:41 AM
naidu9295 Re: Macro to check file... 06-12-2010, 06:40 AM
pike Re: Macro to check file... 06-12-2010, 07:15 AM
pike Re: Macro to check file... 06-12-2010, 07:27 AM
naidu9295 Re: Macro to check file... 06-12-2010, 08:15 AM
  1. #1
    Registered User
    Join Date
    06-10-2010
    Location
    SIngapore
    MS-Off Ver
    Excel 2003
    Posts
    7

    Macro to check file exists and take input from the file

    I dont know what is worng here, its working fine in 2007, but not working in 2003
    can someone please help




    Sub Button2_Click()
    Call COB
    Call Read_Result_File
    End Sub
    
    Sub Read_Result_File()
    Dim sFile, dFile As Variant
    Dim i, introw, endrow As Integer
    introw = Sheet2.Cells(2, 7)
    endrow = Sheet2.Cells(3, 7)
    On Error Resume Next
    For i = introw To endrow
    Sheet2.Cells(i, 2) = Sheet2.Cells(1, 7) & "\"
    sFile = Sheet2.Cells(i, 1) & Sheet2.Cells(i, 2) & Sheet1.Cells(i, 2)
    dFile = Sheet2.Cells(i, 1) & Sheet2.Cells(i, 2) & Sheet2.Cells(i, 3)
            If Dir(sFile) <> "" Then
            Sheet1.Cells(i, 3) = "File Exists"
                    
                If Dir(dFile) <> "" Then
                Call GetText(dFile, i)
                Else
                Sheet1.Cells(i, 4) = "Feed Not Delivered"
                End If
                    
        Else
        Sheet1.Cells(i, 3) = "File Doesnt exists"
        Sheet1.Cells(i, 4) = "Feed Not Delivered"
        End If
    Next i
    End Sub
    
    
    Sub GetText(tFile As Variant, j As Variant)
    Dim oText As String
    Open tFile For Input As #1
    oText = Input$(LOF(1), #1)
    MsgBox oText
    Close
      If oText = 0 Then
        Sheet1.Cells(j, 4) = "Feed Delivered"
        Else
        Sheet1.Cells(j, 4) = "Feed Not Delivered"
        End If
    End Sub
    
    Function COB()
    Sheet2.Cells(1, 7) = InputBox("Enter COB Date")
    Sheet2.Cells(2, 7) = InputBox("Enter int row : Range 1 to 3")
    Sheet2.Cells(3, 7) = InputBox("Enter End row : Range 1 to 3")
    End Function
    Last edited by naidu9295; 06-11-2010 at 05:01 AM. Reason: comply to forum rule 3

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