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

[µo°Ý] ²{¦b­n¦p¦ó¨ìÃÒ¥æ©Ò¤U¸ü¥~¸ê¦¨¥æ¸ê°T

½Ð°Ý§Ú¬O·Q±NÃÒ¥æ©Òªº¨C¤é¦¬½L¦æ±¡(¤£§tÅvÃÒ¤ûºµÃÒ)¡A¶K¤Wexcel¡A²{¦b¥Îpostªk¸Ó«ç»ò¼gªº
­ì¥»getªk¬O³o¼Ë¼gªº
Sub getSIIPrice()
    urlStr = "URL;http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/genpage/Report" & Format(Sheets("UI").Range("A21").Value, "YYYYMM") & "/A112" & Format(Sheets("UI").Range("A21").Value, "YYYYMMDD") & "ALLBUT0999_1.php?select2=ALLBUT0999&chk_date=" & Year(Sheets("UI").Range("A21").Value) - 1911 & "/" & Format(Sheets("UI").Range("A21").Value, "MM/DD")
    Sheets("SIIPrice").Select
    Cells.Select
    Selection.Delete Shift:=xlUp
    With ActiveSheet.QueryTables.Add(Connection:= _
        urlStr _
        , Destination:=Range("A1"))
        .Name = "19"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "10"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
        .Delete
    End With
End Sub

«á¨Ó§Ú±Nºô§}§ï¬°http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/MI_INDEX.php
ActiveSheet.QueryTables.Add¼W¥[¤@­ÓPostText°Ñ¼Æ«o¤£¦æ
½Ð°Ý¸Ó¦p¦ó§ó§ï©O?

TOP

·PÁÂS¤j¦^ÂÐ
¥Ø«e§ï¦¨³o¼Ë
Sub getSIIPrice()

    urlStr = "URL;http://www.twse.com.tw/ch/trading/exchange/MI_INDEX/MI_INDEX.php"
    Sheets("SIIPrice").Select
    Cells.Select
    Selection.Delete Shift:=xlUp
  With ActiveSheet.QueryTables.Add(Connection:= _
    urlStr _
     , Destination:=Range("A1"))
      .WebTables = "2"
      .PostText = "downlod=&qdate=104%2F03%2F12&selectType=ALLBUT0999"
      .Name = "19"
      .FieldNames = True
      .RowNumbers = False
      .FillAdjacentFormulas = False
      .PreserveFormatting = True
      .RefreshOnFileOpen = False
      .BackgroundQuery = True
      .RefreshStyle = xlInsertDeleteCells
      .SavePassword = False
      .SaveData = True
      .AdjustColumnWidth = True
      .RefreshPeriod = 0
      .WebSelectionType = xlSpecifiedTables
      .WebFormatting = xlWebFormattingNone
      .WebTables = "10"
      .WebPreFormattedTextToColumns = True
      .WebConsecutiveDelimitersAsOne = True
      .WebSingleBlockTextImport = False
      .WebDisableDateRecognition = False
      .WebDisableRedirections = False
      .Refresh BackgroundQuery:=False
      .Delete
   End With
End Sub

¦ý¬O¨S¦³¦^¶Ç¸ê®Æ¡A¤£ª¾°ÝÃD¥X¦b­þ?

TOP

¦^´_ 7# stillfish00
·PÁÂS¤jªº«ü±Ð
¤w¸g¥i¥H¨Ï¥Î¤F
¦ý¬O¦pªG§Ú·Q­nÅý§ìÀɪº¤é´Áµ¥©óSheets("UI").Range("A22").Value À³¸Ó«ç»ò½s¼g©O?

TOP

        ÀR«ä¦Û¦b : ¡i®É¤é²öªÅ¹L¡j¤@­Ó¤H¦b¥@¶¡°µ¤F¦h¤Ö¨Æ¡A´Nµ¥©ó¹Ø©R¦³¦hªø¡C¦]¦¹¥²¶·»P®É¶¡Ävª§¡A¤Á²ö¨Ï®É¤éªÅ¹L¡C
ªð¦^¦Cªí ¤W¤@¥DÃD