ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Ð°Ý¦p¦ó§ì¨ú®ð¶H§½opendata xml °ÝÃD

¦^´_ 1# yehmengfeng
°Ñ¦Ò¬Ý¬Ý
  1. Sub GetWeatherInfo()
  2.     Dim oXmlhttp As Object: Set oXmlhttp = CreateObject("msxml2.xmlhttp")
  3.     Dim oHtmldoc As Object: Set oHtmldoc = CreateObject("htmlfile")
  4.     Dim oClip As Object: Set oClip = CreateObject("new:{1C3B4210-F441-11CE-B9EA-00AA006B1A69}") 'DataObject
  5.     Dim sURL As String
  6.    
  7.     sURL = "http://e-service.cwb.gov.tw/HistoryDataQuery/MonthDataController.do?command=viewMain&station=467410&datepicker=2016-01"
  8.     With oXmlhttp
  9.         .Open "Get", sURL, False
  10.         .Send
  11.         oHtmldoc.write .responseText
  12.     End With
  13.    
  14.     Dim oTable As Object
  15.     Set oTable = oHtmldoc.GetElementById("MyTable")
  16.     If oTable Is Nothing Then MsgBox "Â^¨úTable¥¢±Ñ...": Exit Sub
  17.    
  18.     'remove top header row (press/temperature...)
  19.     oTable.FirstChild.RemoveChild oTable.FirstChild.ChildNodes(0)
  20.    
  21.     'copy to clip board
  22.     With oClip
  23.         .SetText Replace(oTable.outerhtml, " ", "")
  24.         .PutInClipboard
  25.     End With
  26.    
  27.     Sheets.Add().PasteSpecial NoHTMLFormatting:=True    '¤£­n§t®æ¦¡
  28. End Sub
½Æ»s¥N½X
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

¦^´_ 9# yehmengfeng
°Ñ¦Ò¬Ý¬Ý
®ð¶H.zip (31.7 KB)
ªí¹F¤£²M¡BÃD·N¤£©ú½T¡B¨SªþÀɮ׮榡¡B¨S¦³°Q½×°ÝÃDªººA«×~~~~~~¥H¤W·R²ö¯à§U¡C

TOP

        ÀR«ä¦Û¦b : ¦³´¼¼z¤~¯à¤À¿ëµ½´c¨¸¥¿¡F¦³Á¾µê¤~¯à«Ø¥ß¬üº¡¤H¥Í¡C
ªð¦^¦Cªí ¤W¤@¥DÃD