Excel 2007 Import .txt file error 1004
Did you update the .name line also?
I tested with the following and could import the file without any problem
Sub t()
Cells.Select
Selection.ClearContents
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\Sheeoo\Desktop\Book2.txt" _
, Destination:=Range("$A$1"))
..Name = "Book2.txt*"
..Refresh BackgroundQuery:=False
End With
Cells.Select
End Sub
"Woodstock" wrote:
Well, I did change the name of my text file to simply 123.txt and had the
exact path in the macro, and got the same error.
The macro runs as soon as I open my Spreadsheet - could it be that it is a
sharing violation to a read-only SS?
|