Thread
:
Web query. Rejected by server after 7 updates... Way around?
View Single Post
#
1
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Web query. Rejected by server after 7 updates... Way around?
Using this, I got 12 before having to exit excel and start over.
Sub getdata()
counter = 0
Do Until counter = 20
With Sheets("sheet1").QueryTables(1)
.Connection = _
"URL;http://publicacoes.mj.pt/pt/pesquisa.asp?iNIPC=" & _
"&sFirma=&dfDistrito=11&dfConcelho=06&dInicial=200 9-04-09" & _
"&dFinal=2009-04-10&iTipo=1&sCAPTCHA=" & _
"&pesquisar=Pesquisar&dfConcelhoDesc"
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingAll
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
counter = counter + 1
If Sheets("sheet1").Range("a10") = "Erro" Then
MsgBox "Failed at " & counter
Exit Sub
End If
Loop
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Don Guillett" wrote in message
...
I tried yours and had no problem. As I said, send your wb and I will test.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"SpeeD" wrote in message
...
Hi don
Sorry for the delayed reply.
My code is the following. If you run it 7 times the server rejects the
query, i have to restart excel do continue to query the server. I have
about
15 querys like this i would like to run every day.
What happens when i close excel? does excel keeps any kind of connection
open??
WEB
1
http://publicacoes.mj.pt/pt/pesquisa...oncelh oDesc=
Selection=EntirePage
Formatting=None
PreFormattedTextToColumns=True
ConsecutiveDelimitersAsOne=True
SingleBlockTextImport=False
DisableDateRecognition=False
DisableRedirections=False
"Don Guillett" wrote:
More info such as the url and the method used.
If desired, send your wb to my address below along with a snippet of
this
msg.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"SpeeD" wrote in message
...
Hi!
Im querying a web server trough the excel web query. All is wright
expect
for the fact tha the web server rejects my query after 7 updates.
After
that
i have to to shutdown excel and restarts again to have be able to
update
again.
(The information that im accessing is public and im careful not to
overwhelm the web server).
Is there a way around this problem? does excel keeps the connection
alive,
and there for creates this problem? is there a way to REALLY kill the
connection to the server? im totally new at this web query stuff....
Thanks a lot
Speed
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett