|
来个简单的先!好困啦!改日再学习着做一下
- Sub Weather_forecast15() 'http://www.tianqihoubao.com/lishi/guangzhou/month/201509.html
- 'http://www.15tianqi.com/beijing/
- Dim strText As String
- Cells.Clear
- With CreateObject("MSXML2.XMLHTTP")
- .Open "GET", "http://www.15tianqi.com/beijing/", False
- .setRequestHeader "Connection", "keep-alive"
- .send
- strText = .responsetext
- [a1] = Split(Split(strText, "<h1>")(1), "</h1>")(0)
- strText = Split(Split(strText, "未来15天天气预报★")(1), "由15tianqi.com")(0)
- strText = Replace(strText, ":" & Chr(13) & Chr(10), Chr(9))
- strText = Replace(strText, Chr(13) & Chr(10), "")
- strText = Replace(Replace(strText, ",", Chr(9)), " ", "")
-
- Debug.Print strText
- With CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}")
- .SetText strText
- .PutInClipboard
- End With
-
- Range("A2").Select
- ActiveSheet.Paste
- '[a3:a35].TextToColumns Destination:=Range("a3"), Comma:=True
-
- End With
- End Sub
复制代码 |
|