日語合約翻譯

再按一次 Alt+F11 回到 Excel, 按 Alt+F8 選 GetStoeckInfo 履行它翻譯社 就可在工作表裡看到功效。

Sub 信譽交易(stock As String, tsheet As String, tcell As String)
Call GetWls("trust.cfm", "7", stock, tsheet翻譯社 tcell)
End Sub

Call 信譽交易("2330", "sheet3", "A1")
Call 信譽買賣("2340", "sheet3", "A25")

若要查更多個股, 只需增添 GetStockInfo 裡面的句子即可, 說明以下:

查詢方針: "2330" 指定股號
匯入到那裡: "sheet1" 指定工作表, "A1"指定儲存格

程式重點:

  • 法人持股是 corporation.cfm, 六日行情是  quote6day.cfm翻譯社 信譽買賣是 trust.cfm, 這些是從">阿誰 fortune.wls.com.tw 的網頁上看來的。
  • scode 這個參數可從現實操作或從網頁原始碼看出來 。
  • .WebSelectionType = xlSpecifiedTables 示意不抓整頁翻譯社 只抓頁面上某些表格翻譯
  • .WebTables = "7" 表示要抓的是頁面上第7個表格。
  • .Name 的內容文字可以自由決議。
  • 參考: >抓取台北期交所 (Taifex) 網站供給的資訊(上) ; >抓取台北期交所 (Taifex) 網站供應的資訊(下)

    按 Alt+F11 進入 VBE翻譯社 插入一個模組, 把底下程式碼悉數貼到插入的模組裡翻譯

    問題:


    Sub GetWls(cfm As String翻譯社 tbl As String翻譯社 stock As String, tsheet As String, tcell As String)
        With Worksheets(tsheet).QueryTables.Add(Connection:= _
            "URL;http://fortune.wls.com.tw/stock/company/" & cfm & "?scode=" & stock, _
            Destination:=Worksheets(tsheet).Range(tcell))
            .Name = cfm & "_" & stock
            .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 = tbl
            .WebPreFormattedTextToColumns = True
            .WebConsecutiveDelimitersAsOne = True
            .WebSingleBlockTextImport = False
            .WebDisableDateRecognition = False
            .WebDisableRedirections = False
            .Refresh BackgroundQuery:=False
        End With
    End Sub


    Sub GetStockInfo()

    Call 法人持股("2330", "sheet1", "A1")
    Call 法人持股("2340", "sheet1", "A35")

    Sub 法人持股(stock As String, tsheet As String翻譯社 tcell As String)
    Call GetWls("corporation.cfm", "6翻譯社7翻譯社8,9", stock, tsheet, tcell)
    End Sub
    Sub 六日行情(stock As String翻譯社 tsheet As String, tcell As String)
    Call GetWls("quote6day.cfm"翻譯社 "6", stock翻譯社 tsheet, tcell)
    End Sub