ªð¦^¦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

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

¦^´_ 4# GBKEE


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

TOP

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

¦^´_ 3# pupai
  1. Option Explicit
  2. Sub ¥~¸ê¤Î³°¸ê¶R½æ¶W·JÁ`ªí()
  3.     Dim URL As String, xDate As Date
  4.     xDate = Date - 1   '¸g¬d: ¥~¸ê¤Î³°¸ê¶R½æ¶W·JÁ`ªí ´£¨Ñ«e¤@Àç·~¤éªº¸ê®Æ
  5. ReDate:
  6.     URL = "URL;http://www.twse.com.tw/ch/trading/fund/TWT38U/TWT38U.php?qdate=" & Format(xDate, "E/M/D")
  7.     With ActiveSheet.QueryTables.Add(Connection:=URL, Destination:=ActiveSheet.Range("a1"))
  8.         .WebSelectionType = xlSpecifiedTables
  9.         .WebFormatting = xlWebFormattingNone
  10.         .WebTables = "5"
  11.         .WebPreFormattedTextToColumns = True
  12.         .WebConsecutiveDelimitersAsOne = True
  13.         .WebSingleBlockTextImport = False
  14.         .WebDisableDateRecognition = False
  15.         .WebDisableRedirections = False
  16.         .Refresh BackgroundQuery:=False
  17.         If Application.CountA(.ResultRange) = 0 Then '«DÀç·~¤é,¨S¦³¸ê®Æ.
  18.             xDate = xDate - 1                        '©¹«á°h¤@¤é
  19.             GoTo ReDate
  20.         End If
  21.     End With
  22. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_ 2# GBKEE


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

TOP

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

¦^´_ 1# pupai
¨C¤@ºô­¶ªº¤¸¯À·|¦³©Ò¤£¦P.
  1. Option Explicit
  2. Sub ¥~¸ê¤Î³°¸ê¶R½æ¶W·JÁ`ªí()
  3.     Dim URL As String, xDate As Date
  4.     xDate = Format(Date-1, "E/M/D")
  5.     URL = "URL;http://www.twse.com.tw/ch/trading/fund/TWT38U/TWT38U.php?qdate=" & xDate
  6.     With ActiveSheet.QueryTables.Add(Connection:=URL, Destination:=ActiveSheet.Range("a1"))
  7.         .WebSelectionType = xlSpecifiedTables
  8.         .WebFormatting = xlWebFormattingNone
  9.         .WebTables = "5"
  10.         .WebPreFormattedTextToColumns = True
  11.         .WebConsecutiveDelimitersAsOne = True
  12.         .WebSingleBlockTextImport = False
  13.         .WebDisableDateRecognition = False
  14.         .WebDisableRedirections = False
  15.         .Refresh BackgroundQuery:=False
  16.     End With
  17. End Sub
  18. Sub §ë«H¶R½æ¶W·JÁ`ªí()
  19.     Dim URL As String, xDate As Date
  20.     xDate = Format(Date-1, "E/M/D")
  21.     URL = "URL;http://www.twse.com.tw/ch/trading/fund/TWT44U/TWT44U.php?qdate=" & xDate
  22.     With ActiveSheet.QueryTables.Add(Connection:=URL, Destination:=ActiveSheet.Range("D4"))
  23.         .Connection = URL
  24.         .WebSelectionType = xlSpecifiedTables
  25.         .WebFormatting = xlWebFormattingNone
  26.         .WebTables = "5"
  27.         .WebPreFormattedTextToColumns = True
  28.         .WebConsecutiveDelimitersAsOne = True
  29.         .WebSingleBlockTextImport = False
  30.         .WebDisableDateRecognition = False
  31.         .WebDisableRedirections = False
  32.         .Refresh BackgroundQuery:=False
  33.     End With
  34. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ºÉ¦h¤Ö¥»¥÷¡A´N±o¦h¤Ö¥»¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD