Home > Software engineering >  Why this code, download the web is not normal?
Why this code, download the web is not normal?

Time:11-01

I wrote A piece of code, use VBA is used to download unit internal web pages, I work in the thin A column in the table 6 joined the enterprise code, then fill with VBA in turn read the enterprise code query box, and then with the enterprise information in web framework, I found A web url in framework, direct landing site, download the enterprise information, now the problem is I enterprise code A download A input query is normal, but once the enterprise code into A column read automatically fill in the framework, automatic query page is normal, but download only download the first cycle, cycle again can't download, I write the code is as follows:
 
Sub enterprise information ()
On the Error Resume Next
Dim mytrade As String, waitTime As String, ie As Object, y As Integer

Set the ie=CreateObject (" InternetExplorer. Application ")

Intnum=Application. WorksheetFunction. CountA ([A: A])
For y=1 To intnum - 1
Application. ScreenUpdating=True

Mytrade=Sheet6. Cells (y + 1, 1). The Value
'mytrade="4404110005"
With CreateObject (" InternetExplorer. Application ")
The Visible=True
. Navigate "http://10.55.7.80/entmgr/App_Web/ent_base.aspx"
Do Until the ReadyState=4
DoEvents
Loop
. Document. All (" DropDownList1 "). The Value="https://bbs.csdn.net/topics/trade_co"
. Document. All (" ZLTextBox7 "). The Value=https://bbs.csdn.net/topics/mytrade
. The Document. The getElementById (" Button2 "). Click
WaitTime=TimeSerial (Hour (Now ()), Minute (Now ()), Second (Now ()) + 1)
Application. Wait waitTime

. The Document. The getElementById (" GridView1_ctl02_btnSelect "). Click
WaitTime=TimeSerial (Hour (Now ()), Minute (Now ()), Second (Now ()) + 1)
Application. Wait waitTime

. Navigate "http://10.55.7.80/entmgr/App_Web/ent_baseinfo.aspx"
WaitTime=TimeSerial (Hour (Now ()), Minute (Now ()), Second (Now ()) + 1)
Application. Wait waitTime
N=Sheet1. Range (" A65536 "). The End (xlUp). Row + 1
The Set r=. Document. All tags (" table ") (0). The Rows
For I=0 To r.L ength - 1
For j=1 To r (I) Cells. The Length - 1 Step 2
K=k + 1
Sheet1. Cells (n, k)=r (I) Cells (j) the innerText
Next j
Next I
The Set r=Nothing
. The Quit

End With
Next y
End Sub

CodePudding user response:

Used in packet technology better, the speed can improve the livelihood, hundreds of thousands of times in general are also less likely to make mistakes

CodePudding user response:

Thank you, can say detailed point?
  •  Tags:  
  • VBA
  • Related