选择要上载的文件 - Excel VBA

时间:2018-04-17 15:50:45

标签: excel vba excel-vba internet-explorer

我试图自动化一个系统,它会更新费率并自动上传。到目前为止,我已经管理了以下内容:

Dim i As Long
Dim ie As Object

website = "https://www.citycurrencyexchange.co.uk/control/login.php?accesscheck=%2Fcontrol%2Findex.php"

Set ie = CreateObject("InternetExplorer.Application")
With ie

    .Visible = True
    .navigate website
    .resizable = True

End With

While ie.readyState <> 4 Or ie.Busy: DoEvents: Wend
On Error Resume Next

ie.document.getElementById("username").Value = username
ie.document.getElementById("password").Value = password
ie.document.getElementById("button").Click

While ie.readyState <> 4 Or ie.Busy: DoEvents: Wend

website = "https://www.citycurrencyexchange.co.uk/control/ratescsv.php"
ie.navigate website
While ie.readyState <> 4 Or ie.Busy: DoEvents: Wend

我被迫要求我上传文件:

Screenshot

要上传的文件是基于我们网络的csv文件,其路径为 - \ 192.168.10.200 \ Data \ Xenox \ Rates(Xenox)\ Rates \ Victoria(TEG)+ City Currency Exchange \ ExchangeRates.csv

这完全可能还是需要人为输入?

此外,上面编写的代码不会起作用,因为用户名和密码已被替换。粘贴在上面以供参考。

以下是与&#34;选择文件&#34;相关的HTML代码。按钮。

<input name="uploadedfile" type="file" id="uploadedfile" accept="application/csv" onchange="checkFileName();">

非常感谢。

0 个答案:

没有答案