|
- Sub WordVBA网抓()
- Dim strText$, i%, Otxt$, t1$, t2$, t3$
- Application.ScreenUpdating = False
- Application.DisplayAlerts = wdAlertsNone
- With CreateObject("msxml2.xmlhttp")
- For i = 2 To 395
- .Open "GET", "http://www.tcm100.com/user/hxsjshl/zzbook" & i & ".htm", False
- .send
- strText = .responseText
- With CreateObject("htmlfile")
- .write strText
- Set node = .getElementById("Panel_Article")
- t1 = node.all.tags("div")(0).innerText
- t2 = node.all.tags("div")(1).innerText
- t3 = node.all.tags("div")(6).innerText
- Otxt = Otxt & t1 & Chr(13) & t2 & Chr(13) & t3
- End With
- Next
- End With
- Application.DisplayAlerts = wdAlertsAll
- Application.ScreenUpdating = True
- Documents.Add.Content.Text = Otxt
- End Sub
复制代码 |
|