投稿‎ > ‎

VBAで遊ぼう⑧

posted Jun 9, 2016, 1:45 AM by Zhang Wenxu
Public Function DevnetDownloadByIDAndSeq(id As String, seq As String) As String
    Dim ie As InternetExplorer
    Dim seqButton As Object
    Dim downloadButton As Object
    Dim filename As String
    Dim wk As Workbook

    Call searchID(id)
    Set ie = getProcenter()

    filename = seq & "-" & getValueByName(ie, "ファイル名")
    ie.document.frames("main").document.all("SUB_MENU").selectedIndex = 4
    Call ie.document.frames("main").document.all("opbtn").Click
    Call waitIE(ie)
    Set seqButton = findInputByValue(ie, seq)
    Call seqButton.Click
    Call waitIE(ie)

    Set downloadButton = findInputByValue(ie, "ダウンロード")
    Call waitIE(ie)
    Call downloadButton.Click
    Sleep 500
    filename = saveFileDialog(ie, workDir & filename)
    Set wk = Workbooks.Open(filename)
    Call saveCustomProp(wk, C_DEVNET_ID, id)
    Call saveCustomProp(wk, C_DEVNET_SEQ, seq)
    wk.Save
    wk.Close
    DevnetDownloadByIDAndSeq = filename
End Function
Comments