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

[µo°Ý] ºô¯¸³z¹LQueryTable¤U¸üªº¤é´Á°ÝÃD

[µo°Ý] ºô¯¸³z¹LQueryTable¤U¸üªº¤é´Á°ÝÃD

¦U¦ì¤j¤j¦n,¤p§Ì·Q³z¹LVBA ªºQueryTable ¤U¸ü¹d¦ëºôªºªÑ²¼¸ê°T
ºô§}¦p¤U:
https://www.cnyes.com/twstock/ps_historyprice/2327.htm

¹J¨ìªº°ÝÃD¦p¤U:
µLªk¥Îµ{¦¡½X±±¨î°_©l¤é´Á.postText°e¥Xªº¸ê°T,µLªk¥¿½T¬d¸ß¨ì§Ú©Ò«ü©wªº¤é´Á
¦ýºô¯¸¹ê»Ú¤W¬O¥i¥H±±¨î°_©l¤é´Áªº
·Q½Ð°Ý¦U¦ì¤j¤j­n¦p¦ó­×§ïµ{¦¡½X?

¤U¸ü¨ì(DL¤À­¶)ªºµ{¦¡½X¦p¤U:
  1. Sub test1()
  2. Dim QT As QueryTable
  3. Dim WebAddress As String
  4. WebAddress = "http://www.cnyes.com/twstock/ps_historyprice/2327.htm"
  5. With ThisWorkbook.Worksheets("DL")
  6.     .Cells.Clear
  7.     Set QT = .QueryTables.Add("URL;" & WebAddress, .Range("$A$1"))
  8. End With
  9. With QT
  10. .PostText = "ctl00$ContentPlaceHolder1$startText=" & " 2019/01/01" & "&ctl00$ContentPlaceHolder1$endText=" & " 2020/03/06"
  11. .WebTables = "1"
  12. .Refresh False
  13. .Delete
  14. End With
  15. End Sub
½Æ»s¥N½X
PKKO

¦^´_ 1# PKKO

¸Õ¸Õ¬Ý³o­Ó¡G
    Sub test1()
Dim QT As QueryTable
Dim WebAddress As String
    ' WebAddress = "http://www.cnyes.com/twstock/ps_historyprice/2327.htm"

WebAddress = "https://www.cnyes.com/twstock/ps_historyprice.aspx?"
WebAddress = WebAddress & "code=2327"
WebAddress = WebAddress & "&ctl00$ContentPlaceHolder1$startText=2019/01/01"
WebAddress = WebAddress & "&ctl00$ContentPlaceHolder1$endText=2020/03/06"

With ThisWorkbook.Worksheets("DL")
    .Cells.Clear
    Set QT = .QueryTables.Add("URL;" & WebAddress, .Range("$A$1"))
End With
With QT
   ' .PostText = "ctl00$ContentPlaceHolder1$startText=" & " 2019/01/01" & "&ctl00$ContentPlaceHolder1$endText=" & " 2020/03/06"
.WebTables = "1"
.Refresh False
.Delete
End With
End Sub

TOP

¦^´_ 2# Scott090


    §¹¥þ¥i¥H!!!

·PÁ¤j¤j

§Ú³£§Ñ¤F¥i¥H±qºô§}ª½±µ¸Õ¸Õ¬Ý
«D±`·PÁÂ

¥u¬O«Ü©_©Ç,¤£ª¾¹D.postText ¿ù¦b­þÃäµLªk¦¨¥\= =
¤£¹L¥i¥H¥Î´N«Ü´Î¤F,¦A¦¸¸U¤À·PÁ¤j¤j!!!
PKKO

TOP

¥»©«³Ì«á¥Ñ Scott090 ©ó 2020-3-8 14:34 ½s¿è

¦^´_ 3# PKKO

¦A´ú¸Õ¦p¤U¡G
       Sub test1()
Dim QT As QueryTable
Dim WebAddress As String
  '  WebAddress = "http://www.cnyes.com/twstock/ps_historyprice/2327.htm"

WebAddress = "https://www.cnyes.com/twstock/ps_historyprice.aspx?code=2327"
With ThisWorkbook.Worksheets("DL")
    .Cells.Clear
    Set QT = .QueryTables.Add("URL;" & WebAddress, .Range("$A$1"))
End With
With QT
     '.PostText = "ctl00$ContentPlaceHolder1$startText=" & " 2019/01/01" & "&ctl00$ContentPlaceHolder1$endText=" & " 2020/03/06"
'¤é´Á»Pµ¥¸¹¶¡¤£­n¦³ªÅ®æ
'======================
   .PostText = "ctl00$ContentPlaceHolder1$startText=" & "2019/01/01" & "&ctl00$ContentPlaceHolder1$endText=" & "2020/03/06"
.WebTables = "1"
.Refresh False
.Delete
End With
End Sub

TOP

¦^´_ 4# Scott090


    ­ì¨Ó¦p¦¹
§Ú»{¬°¬Oºô§}°ÝÃD
¦]¬°§Ú¤§«e¦³§âªÅ®æ§R°£¹L
·PÁ¤j¤j
PKKO

TOP

        ÀR«ä¦Û¦b : ¤H­nª¾ºÖ¡B±¤ºÖ¡B¦A³yºÖ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD