close

論文摘要翻譯服務

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

查詢目標: "2330" 指定股號
匯入到那裡: "sheet1" 指定工作表翻譯社 "A1"指定儲存格

程式重點:


Sub GetStockInfo()

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


用EXCEL抓取外部資料

http://fortune.wls.com.tw/stock/company/trust.cfm

在此網址中有可輸入代碼,希望輸入代碼後可以泛起:法人持股、六日行情、信譽買賣三部份......

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

End Sub

解答:

Call 六日行情("2330", "sheet2", "A1")
Call 六日行情("2340", "sheet2"翻譯社 "A10")

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

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

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

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

    問題:

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

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



本文來自: http://blog.udn.com/WayCheng/2767134有關各國語文翻譯公證的問題歡迎諮詢華頓翻譯公司02-77260932
arrow
arrow
    文章標籤
    翻譯社
    全站熱搜
    創作者介紹
    創作者 richarj2804 的頭像
    richarj2804

    richarj2804@outlook.com

    richarj2804 發表在 痞客邦 留言(0) 人氣()