来自ddos保护网站的VBA Dowload文件

时间:2017-06-20 15:51:29

标签: vba excel-vba excel

有人知道如何使用Excel VBA获取此文件吗?

https://www.centralbankmalta.org/site/excel/statistics/financial_market_int_rates.xls

我使用了这段代码,但现在它不再起作用了:

def military_time(minutes):
    if minutes < 600:
        hour = minutes // 60 
        minute = minutes % 60
        print("0{0:0}{0:0}".format(hour,minute))
    elif 600 < minutes < 720:
        hour = minutes // 60
        minute = minutes % 60
        print("{0:0}{0:0}".format(hour,minute))
    elif minutes == 720:
        hour = 1200
        print(hour)
    else:
        hour = ((minutes-720) // 60) + 12
        minute = (minutes) % 60
        print("{0:0}{0:0}".format(hour,minute))

我也尝试过:

Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

URLDownloadToFile 0, "https://www.centralbankmalta.org/site/excel/statistics/financial_market_int_rates.xls", "X:\TESORERIA\07 Prestamos\Préstamos 2016\financial_market_int_rates.xls", 0, 0

此代码下载此信息而不是数字 enter image description here

所以我认为问题是ddos保护...或者可能是我已经将Office 2010更新到365?

感谢您的时间

1 个答案:

答案 0 :(得分:1)

call shell("https://www.centralbankmalta.org/site/excel/statistics/financial_market_int_rates.xls")

call shell("iexplore https://www.centralbankmalta.org/site/excel/statistics/financial_market_int_rates.xls")

将是最基本的方式。如果您需要它更漂亮,您可以使用Web浏览器控件并提供该URL。这将触发它的行为与浏览器对待它的行为相同。