我想上运行的Microsoft Excel这个宏,但每次我这样做的时候,我得到一个Excel的VBA - 比特币
运行时错误“5”
我在做什么错? 这是我第一次做这样的事情。
假设发生的事情是,每次运行键盘快捷键时,都会从区块链网站获取数据。
它本质上只是代码,说..
1美元是值得这么多的BTC
Sub USD_to_BTC()
'
' USD_to_BTC Macro
' Get the price of 1 btc if purchased by 1 USD
'
' Keyboard Shortcut: Ctrl+Shift+B
'
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://blockchain.info/tobtc?currency=USD&value=1", Destination:=Range(_
"$D$8"))
.CommandType = 0
.Name = "tobtc?currency=USD&value=1_1"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
难道我补充一点,整个3号线你刚才提到我的整个代码下方?对不起,我是VBA新手。试图找出在我的代码中添加的地方,所以它不会给我一个错误9问题。 – user6260366
你应该首先应用BruceWayne的解决方案来解决你的错误(我在上面提到的第一点,但是如果你的查询表已经存在于工作表中,那么你可以在你的整个代码下面添加我的3行代码。更新您的键盘快捷键以调用RefreshQueryTable而不是您的方法。 –