有人知道如何使用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
所以我认为问题是ddos保护...或者可能是我已经将Office 2010更新到365?
感谢您的时间
答案 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。这将触发它的行为与浏览器对待它的行为相同。