0
我需要編寫一個宏,它從以下URL導入數據: www.gfigroup.com/docs/sef/marketdata/2014-04-08_daily_trade_data.xls。 如果您將其複製並粘貼到瀏覽器中,它將導入一個xls文件。 我使用的代碼如下:從URL導入xls文件時運行時錯誤'1004'
Dim wbMe As Workbook
Dim wsNew As Worksheet
Dim w As Integer
Dim wbURL As Workbook
Dim url As String
Set wbMe = ThisWorkbook
url = "www.gfigroup.com/docs/sef/marketdata/2014-04-08_daily_trade_data.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("A2")
'## Close the downloaded version which we no longer need:'
wbURL.Close
不過,當我運行它,」我有這個運行時錯誤‘1004’說,它無法找到的ressource,並詢問是否已被刪除或重命名。 有沒有人已經遇到過這個問題?最終找到了解決方案。
謝謝。
酷。簡直不敢相信。 – user3516255
非常感謝 – user3516255