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

·J¤JÃÒ¥æ©Òªº¸ê®ÆµLªk§ó·s

¦^´_ 1# lman
  1. Sub Ex()
  2.     With ActiveSheet.QueryTables(1)
  3.         .Connection = _
  4.         "URL;http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/genpage/Report" & Format(ActiveSheet.[A1], "YYYYMM") & "/A112" & Format(ActiveSheet.[A1], "YYYYMMDD") & "MS.php?select2=MS&chk_date=" & Format(ActiveSheet.[A1], "EE/MM/DD")
  5.         .WebSelectionType = xlSpecifiedTables
  6.         .WebFormatting = xlWebFormattingNone
  7.         .WebTables = "8"
  8.         .WebPreFormattedTextToColumns = True
  9.         .WebConsecutiveDelimitersAsOne = True
  10.         .WebSingleBlockTextImport = False
  11.         .WebDisableDateRecognition = False
  12.         .WebDisableRedirections = False
  13.         .Refresh BackgroundQuery:=False
  14.     End With
  15. End Sub
½Æ»s¥N½X

TOP

¦^´_ 4# lman   
µ{¦¡½X¤º®e¨S¦³¶×¤J¸ê®Æ¦s©ñªºÀx¦s®æ
¬°¦ó©ñA3¥i¥H¦Û°Ê§ó·s


¦]¬°µ{¦¡®M¤W§AªþÀɤu§@ªí¤¤¤w¦³¤@­Ó¥~³¡¸ê®Æ¨Ó·½©Ò¶Ç¦^¤§¸ê®Æªº¬d¸ßªí ¨Ã«ü©w¤Fºô§}
¥u­n¨S¦³§R°£³o¬d¸ßªí °õ¦æµ{¦¡ ´N·|§ó·s¸ê®Æ
With  ActiveSheet.QueryTables(1)    '¥Nªí«ü©w¤u§@ªí¤¤¥~³¡¸ê®Æ¨Ó·½©Ò¶Ç¦^¤§¸ê®Æªº²Ä¤@­Ó¬d¸ßªí
.Connection = _
        "URL;http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/genpage/Report" & Format(ActiveSheet.[A1], "YYYYMM") & "/A112" & Format(ActiveSheet.[A1], "YYYYMMDD") & "MS.php?select2=MS&chk_date=" & Format(ActiveSheet.[A1], "EE/MM/DD")      '¬d¸ßªíªººô§}
¦pªG¬O«ü©w¶×¤J¸ê®Æ¦s©ñªºÀx¦s®æ
  1. Sub Ex()
  2. Dim Rng As Range, OldRng$
  3. Set Rng = ActiveSheet.[J1] '«ü©w·sªº¦ì§} ¥B¤w«ü©w¤é´Á
  4. On Error GoTo QueryTablesAdd
  5. With Rng.QueryTable
  6. .Connection = _
  7. "URL;http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/genpage/Report" & Format(Rng, "YYYYMM") & "/A112" & Format(Rng, "YYYYMMDD") & "MS.php?select2=MS&chk_date=" & Format(Rng, "EE/MM/DD")
  8. .WebSelectionType = xlSpecifiedTables
  9. .WebFormatting = xlWebFormattingNone
  10. .WebTables = "8"
  11. .WebPreFormattedTextToColumns = True
  12. .WebConsecutiveDelimitersAsOne = True
  13. .WebSingleBlockTextImport = False
  14. .WebDisableDateRecognition = False
  15. .WebDisableRedirections = False
  16. .Refresh BackgroundQuery:=False
  17. End With
  18. End
  19. QueryTablesAdd:
  20. OldRng = Rng.Value
  21. Rng.Value = ""
  22. With ActiveSheet.QueryTables.Add(Connection:= _
  23. "URL;http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/genpage/Report201007/A11220100723MS.php?select2=MS&chk_date=99/07/23", Destination:=Rng)
  24. .Name = "¤j½L²Î­p¸ê°T"
  25. .WebTables = "8"
  26. .Refresh BackgroundQuery:=False
  27. .ResultRange.ClearFormats
  28. End With
  29. Rng.Value = OldRng
  30. Resume
  31. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ½_ÁJµ²±o¶V¹¡º¡¡A¶V·|©¹¤U««¡A¤@­Ó¤H¶V¦³¦¨´N¡A´N­n¶V¦³Á¾¨Rªº¯ÝÃÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD