Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Multifile Code Error
MJ
It's hard to say. Record a macro while opening a file manually and compare the arguments you get in the recorded macro to the arguments you have here. Any differences may be the source of the problem. -- Dick Kusleika MVP - Excel www.dicks-clicks.com Post all replies to the newsgroup. "mjwilliams" wrote in message m... Could someone please tell me why I'm getting the RT error 1004, "Method 'OpenText' of object 'Workbooks' failed" when I run this code? Sub MultiFile() With Application.FileSearch .NewSearch .LookIn = "M:\results" .SearchSubFolders = False .FileType = msoFileTypeAllFiles If .Execute() 0 Then For i = 1 To .FoundFiles.Count Workbooks.OpenText Filename:=.FoundFiles(i), Origin:=437, StartRow:=6, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, _ Comma:=False, Space:=True, Other:=False, FieldInfo:=Array(Array(1, 1), _ Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), _ Array(9, 1), Array(10, 1)) 'TrailingMinusNumbers:=True ActiveWorkbook.SaveAs FileFormat:=xlNormal Range("O30").Select ActiveWorkbook.Close SaveChanges:=False Next i Else MsgBox "There were no files found." End If End With End Sub Thank you very much in advance!! MJ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
error in code | Excel Discussion (Misc queries) | |||
Why Im I getting an error in code.. | Excel Discussion (Misc queries) | |||
Code error | Excel Discussion (Misc queries) | |||
error in this code | Excel Worksheet Functions | |||
Code error ?? | Excel Discussion (Misc queries) |