fari1
Active Member
- Joined
- May 29, 2011
- Messages
- 362
I'm establishing the web query in excel From Text rather than from Web in data tab in excel 2007, after too many runs, it start giving the msg
"Run-Time error 1004
Excel cannot find the text file to refresh this external data range
check to make sure the text file has not been removed or renamed, then try the refresh again."
its my code, i've changed the url for privacy reasons
"Run-Time error 1004
Excel cannot find the text file to refresh this external data range
check to make sure the text file has not been removed or renamed, then try the refresh again."
its my code, i've changed the url for privacy reasons
Code:
Dim sts As String
sts = Sheets("WQuery").Range("$A$1")
Sheets("Wquery").Range("A2:A500").ClearContents
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;http://www.google.com" _
& sts, Destination:=Sheets("WQuery").Range("$A$2"))
.Name = _
"browse-e?company"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = False
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 437
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileConsecutiveDelimiter = False
.TextFileTabDelimiter = True
.TextFileSemicolonDelimiter = False
.TextFileCommaDelimiter = False
.TextFileSpaceDelimiter = False
.TextFileColumnDataTypes = Array(1)
.TextFileTrailingMinusNumbers = True
.Refresh BackgroundQuery:=True
End With