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

[µo°Ý] ¦p¦ó¥i¥H«ü©w¤é´Á«á¤U¸ü¸ê®Æ

[µo°Ý] ¦p¦ó¥i¥H«ü©w¤é´Á«á¤U¸ü¸ê®Æ

±z¦n
§Ú§Æ±æµ{¦¡¥i¥H¨Ì·Ó§Ú·Q­nªº¤é´Á¤U¸ü·í¤Ñ¸ê®Æ
¥i¥HÀ°§Ú«ü¾É­×§ï
ÁÂÁÂ!!
  1. Option Explicit
  2. Sub EX()
  3.    
  4.    
  5. Dim URL As String, xCo_Id As String, xSyear As String, xSseason As String
  6.       
  7.        xCo_Id = Range("B1").Value
  8.        xSyear = Range("B2").Value
  9.        xSseason = Range("B3").Value
  10.       
  11. 'xCo_Id = "[" & """¦~«×""" & "," & """102¦~""" & "]"
  12. '­n¨D¿é¤Jºô­¶ªº°Ñ¼Æ:¦~«×
  13. 'xSyear = "[" & """¤ë¥÷""" & "," & """¤ë """ & "]"
  14. 'Format(Date, "e")->¤¤µØ¥Á°êªº¤ë¥÷
  15. 'xSseason = "[" & """¤é""" & "," & """¤é´Á""" & "]"
  16. 'Format(Date, "q")->·í¦~«×ªº¤é´Á


  17. '¥~¸ê¤Î³°¸ê¶R½æ¶W·JÁ`ªí
  18. URL = "URL;http://www.twse.com.tw/ch/trading/fund/TWT38U/TWT38U.php?step=1&CO_ID=" & xCo_Id & "&SYEAR=" & xSyear & "&SSEASON=" & xSseason & "&REPORT_ID=C"
  19.     With ActiveSheet.QueryTables.Add(Connection:=URL, Destination:=Range("D4"))
  20.         .AdjustColumnWidth = False                   '¦Û°Ê½Õ¾ãÄæ¼e
  21.         .WebSelectionType = xlSpecifiedTables
  22.         .WebFormatting = xlWebFormattingNone
  23.         .WebTables = "2"
  24.         .WebPreFormattedTextToColumns = True
  25.         .WebConsecutiveDelimitersAsOne = True
  26.         .WebSingleBlockTextImport = False
  27.         .WebDisableDateRecognition = False
  28.         .WebDisableRedirections = False
  29.         .Refresh BackgroundQuery:=False
  30. End With

  31. '§ë«H¶R½æ¶W·JÁ`ªí
  32. URL = "URL;http://www.twse.com.tw/ch/trading/fund/TWT44U/TWT44U.php?step=1&CO_ID=" & xCo_Id & "&SYEAR=" & xSyear & "&SSEASON=" & xSseason & "&REPORT_ID=C"
  33.     With ActiveSheet.QueryTables.Add(Connection:=URL, Destination:=Range("K5"))
  34.         
  35.         .AdjustColumnWidth = False                   '¦Û°Ê½Õ¾ãÄæ¼e
  36.         .WebSelectionType = xlSpecifiedTables
  37.         .WebFormatting = xlWebFormattingNone
  38.         .WebTables = "2"
  39.         .WebPreFormattedTextToColumns = True
  40.         .WebConsecutiveDelimitersAsOne = True
  41.         .WebSingleBlockTextImport = False
  42.         .WebDisableDateRecognition = False
  43.         .WebDisableRedirections = False
  44.         .Refresh BackgroundQuery:=False
  45.         
  46.     End With

  47.       
  48. End Sub
½Æ»s¥N½X

¦^´_ 2# GBKEE


    ª©¥D
½Ð±Ð¬°¤°»òµ{¦¡¶]¤£¥XªF¦è
ÁÂÁÂ

TOP

¥»©«³Ì«á¥Ñ GBKEE ©ó 2013-12-9 18:12 ½s¿è

¦^´_ 4# GBKEE


·PÁ   
¤£À´ªº«Ü¦h ¦ý¾Ç¨ì¤]«Ü¦h
ÁÂÁÂ!!

TOP

        ÀR«ä¦Û¦b : ¦³®É·í«äµL®É­W¡A¦n¤Ñ­n¿n«B¨Ó³¡C
ªð¦^¦Cªí ¤W¤@¥DÃD