Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using Excel 2007 to import a text delimited file with the path of the
file as part of the macro-recorded process. The name of the file (example): is 123_0201_0228.txt Since the date portion of the name changes, I changed the macro to look for path\123*.txt When I go to run it again, I get the following info box: Run-time error '1004': Microsoft Office Excel cannot access the "path\123*.txt". There are several possible reasons. 1. The file name or path does not exist. 2. The file is being used by another program. 3. The workbook you are trying to save has the same name as a. . . (I don't know how this sentence ends). The portion that fails is as follows: Cells.Select Selection.ClearContents Range("A1").Select With ActiveSheet.QueryTables.Add(Connection:= _ "TEXT;K:\path\123*.txt" _ , Destination:=Range("$A$1")) ..Name = "123*" - truncated to fit window - ..Refresh BackgroundQuery:=False End With Cells.Select |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Import an MS Money 2007 file into MS Excel 2007 worksheet | Excel Discussion (Misc queries) | |||
Run-time error 1004 since upgrading from Excel 2003 to 2007. | Excel Programming | |||
Excel 2007 VBA - Run-time error 1004 | Excel Programming | |||
Error Code 1004 when exporting from VB app to Excel 2007 | Excel Discussion (Misc queries) | |||
runtime error 1004 when opening excel file via VBA in a browser | Excel Programming |