Excel - 每天从在线xls文件导入数据

时间:2013-04-29 00:04:57

标签: excel import

如何在线(http://www.rba.gov.au/statistics/hist-exchange-rates/2010-2013.xls)将在线.xls文件中的数据导入Excel?我无法使用“From Web”数据连接。如果更合适,我可以访问Access。

或者,如何使用每日更新网页中的数据,并每次都保存表格,而不是覆盖前几天的记录?

1 个答案:

答案 0 :(得分:6)

你有没有尝试过这么简单的事情:

Sub OpenXLSfromURL()
Dim wbMe As Workbook
Dim wsNew As Worksheet
Dim w As Integer 
Dim wbURL As Workbook
Dim url As String

Set wbMe = ThisWorkbook
url = "http://www.rba.gov.au/statistics/hist-exchange-rates/2010-2013.xls"
Set wbURL = Workbooks.Open(url)

'## Add code to copy this data to your workbook and/or manipulate the data...'
w = wbMe.Sheets.Count

'## Add a new worksheet to the end of ThisWorkbook:'
Set wsNew = wbMe.Sheets.Add(After:=wbMe.Sheets(w))

'## Copy & Paste this data in to our new worksheet:'
wbURL.Sheets(1).Cells.Copy Destination:=wsNew.Range("A1")

'## Close the downloaded version which we no longer need:'
wbURL.Close

End Sub