Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run time error '1004' on some computers and not others

Status
Not open for further replies.

S4Tyler

Technical User
Jan 12, 2010
11
0
0
US
Hello,

I wrote a macro that imports data from a text file, and uses data imputed in that text file in various other parts of the spreadsheet. Conveniently, the import macro is working fine for everyone in the office except for my boss's computer. When he runs the macro pasted below he gets a "run time error '1004' Excel cannot find the text file" and the debugger highlights ".Refresh BackgroundQuery:=FALSE"

My system does not encounter this issue. We are both using XP SP3 and office 2003 SP3.

Here is the macro:

Sheets("Imported_ORC").Select
Range("A1").Select
With ActiveSheet.QueryTables.Add(Connection:="TEXT;H:\home\OE\jobs\" & Range("JobNumber") & ".orc" _
, Destination:=Range("A1"))
.Name = "12-B-" & Range("A1")
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlReplaceDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlFixedWidth
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1, 1)
.TextFileFixedColumnWidths = Array(33)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=False
End With

Any suggestions would be extremely appreciated.

Thanks,
Tyler
 



Does EVERYONE have an H: Drive that is EXACTLY MAPPED as everyone else?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 


Prferable:
Code:
    With ActiveSheet.QueryTables.Add(Connection:="TEXT;[b]\\ServerName\ShareName[/b]\home\OE\jobs\" & Range("JobNumber") & ".orc" _
        , Destination:=Range("A1"))

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Yes they do, I confirmed this when I wrote it and reconfirmed when this error started showing up.
 
So everyone has H mapped to the same place but have you checked to see if they actually connected?

They may have a permission problem that's keeping them from actually connecting.

sam
 



Your Named Range contains some value.

What is the value on the sheet when it fails?

What is the expected Path & File Name?

Please answer both questions.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top