Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 179
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
error in code des-sa[_2_] Excel Discussion (Misc queries) 5 July 3rd 08 08:09 AM
Why Im I getting an error in code.. N.F[_2_] Excel Discussion (Misc queries) 10 August 8th 07 02:50 AM
Code error M&M[_2_] Excel Discussion (Misc queries) 4 July 13th 07 12:20 AM
error in this code [email protected] Excel Worksheet Functions 2 December 5th 06 05:21 AM
Code error ?? Anthony Excel Discussion (Misc queries) 2 February 9th 05 10:31 PM


All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"