Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
invalid procedure
#1
Hi I get "Invalid call or procedure error" when I run the below script. Can you pls help me fixing it? thx.

error line : If FS.GetFile(Path1).Size <> FS.GetFile(Path2).Size Then

'''''''''''''''complete script'''''''''''''''''
Code:
Public function CompareFiles(Path1, Path2) Dim FS, FirstFile, SecondFile Set FS = CreateObject ("Scripting.FileSystemObject") If FS.GetFile(Path1).Size <> FS.GetFile(Path2).Size Then CompareFiles = True Exit Function End If Set FirstFile = FS.GetFile(Path1).OpenAsTextStream(1,0) Set SecondFile = FS.GetFile(Path2).OpenAsTextStream(1,0) CompareFiles = False Do while FirstFile.AtEndOfStream = False Str1 = FirstFile.Read(1000) Str2 = SecondFile.Read(1000) CompareFiles = StrComp(Str1, Str2, 0) If CompareFiles <> 0 Then CompareFiles = True Exit Do End If Loop FirstFile.Close() SecondFile.Close() End Function File1 = Inputbox("Enter directory for first file ") File1 = Inputbox("Enter directory for seconf file ") If CompareFiles(File1, File2) = False Then Msgbox File1 & " " &File2 &" are same" else Msgbox File1 & " " &File2 &" are not same." End If
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Invalid file error importing xls file Makhado 0 1,815 10-04-2018, 04:33 PM
Last Post: Makhado
  The DataTable.ExportSheet operation failed. Invalid file. Niraj 2 6,975 05-05-2015, 11:40 PM
Last Post: babu123
  Invalid File error importing a spreadsheet but only on a VM msacks 1 3,242 10-19-2014, 09:04 PM
Last Post: supputuri
  Invalid call argument using DateAdd jow 4 4,775 07-18-2012, 12:32 PM
Last Post: K Gaurav Varshney
  Error message 'Invalid Arguments ' sandeephc 3 4,799 06-26-2012, 11:34 AM
Last Post: Ankesh

Forum Jump:


Users browsing this thread: 1 Guest(s)