preludeofme
New Member
- Joined
- Dec 4, 2008
- Messages
- 34
Our company just recently upgraded to office 2010 and some of the scripts are not working anymore. one in particular that's driving me insane is a web query loop. I have been looking everywhere to figure out what the issue is but cannot find a fix.
It loops fine up until about the 70-100th query and then it locks up excel and i have to kill it in the task manager. I have tried dumping the cookies and history every few queries but it doesn't make a difference. Any ideas?
here's the main part of the code that pulls the information and where it is locking up:
It loops fine up until about the 70-100th query and then it locks up excel and i have to kill it in the task manager. I have tried dumping the cookies and history every few queries but it doesn't make a difference. Any ideas?
here's the main part of the code that pulls the information and where it is locking up:
Code:
Sub RunQuery()
Do Until ActiveCell.Value = ""
range("Activevalue").value = activecell.value
Range("Activevalue").Value = Left(Replace(Range("A1").Value, "-", ""),9)
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;webaddress & Range("Activevalue").Value _
, Destination:=Range("H1"))
.Name = _
"=webaddress" & Range("ActiveValue").Value
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = False
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlSpecifiedTables
.WebFormatting = xlWebFormattingNone
.WebTables = """InformationGrid"""
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
If x = 15 Then
' whack temp files - Process 8
Shell "RunDll32.exe InetCpl.Cpl, ClearMyTracksByProcess 8"
Shell "RunDll32.exe InetCpl.Cpl, ClearMyTracksByProcess 1"
x = 0
Else
x = x + 1
End If
activecell.offset(1,0).select
Loop
End Sub