Same problem. I tried surrounding it using a With and .FIND but got another error. Invalid procedure call or argument. Here is what I'm running. My If statement sort of returns the numbers I want but the check always goes to ELSE so it only works half the time.
tf = ActiveWorkbook.Path & "\ImpellerFiles\"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(tf)
Set fc = f.Files
iFile = 1
cIndex = 6
For Each f1 In fc
Workbooks.OpenText Filename:=tf & f1.Name _
, Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlNone, ConsecutiveDelimiter:=True, Tab:=False, Semicolon:=False, Comma _
:=False, Space:=True, Other:=False, OtherChar:="|", FieldInfo:=Array( _
Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1)), _
TrailingMinusNumbers:=True
BladeWorkbook = ActiveWorkbook.Name
Range("k1").Activate
ActiveCell.Value = BladeWorkbook
With Worksheets(1).Range("k1")
Cut = Left(Right(k1, Len(k1) - 1), .Find("-Pre", Right(k1, Len(k1) - 1)) - 1)
End With
If (ActiveCell.Value <= Z) Then
Z = Mid(BladeWorkbook, 3, 5)
Else
Y = Mid(BladeWorkbook, 2, 5)
End If