首先,我确实意识到这个论坛对这个问题有很多答案,但显然,这个错误信息可能指向许多实际上的错误。我尝试了很多解决方案,但没有一个能为我工作。 所以,我们在这里,代码:
Sub GetWebTable()
Dim AlgoIn(1 To 13) As String
Dim HRIn(1 To 13) As String
Dim ConsIn(1 To 13) As String
Dim Custo As String
Dim QtdPlacas(1 To 16) As String
Dim Algos(1 To 13) As String
Dim HRs(1 To 13) As String
Dim Cons(1 To 13) As String
Dim i As Integer
Algos(1) = "ð="
Algos(2) = "&grof="
Algos(3) = "&x11gf="
Algos(4) = "&cn="
Algos(5) = "&cn7="
Algos(6) = "&eq="
Algos(7) = "&lre="
Algos(8) = "&ns="
Algos(9) = "&tt10="
Algos(10) = "&x16r="
Algos(11) = "&skh="
Algos(12) = "&n5="
Algos(13) = "&xn="
HRs(1) = "&factor%5Beth_hr%5D="
HRs(2) = "&factor%5Bgro_hr%5D="
HRs(3) = "&factor%5Bx11g_hr%5D="
HRs(4) = "&factor%5Bcn_hr%5D="
HRs(5) = "&factor%5Bcn7_hr%5D="
HRs(6) = "&factor%5Beq_hr%5D="
HRs(7) = "&factor%5Blrev2_hr%5D="
HRs(8) = "&factor%5Bns_hr%5D="
HRs(9) = "&factor%5Btt10_hr%5D="
HRs(10) = "&factor%5Bx16r_hr%5D="
HRs(11) = "&factor%5Bskh_hr%5D="
HRs(12) = "&factor%5Bn5_hr%5D="
HRs(13) = "&factor%5Bxn_hr%5D="
Cons(1) = "&factor%5Beth_p%5D="
Cons(2) = "&factor%5Bgro_p%5D="
Cons(3) = "&factor%5Bx11g_p%5D="
Cons(4) = "&factor%5Bcn_p%5D="
Cons(5) = "&factor%5Bcn7_p%5D="
Cons(6) = "&factor%5Beq_p%5D="
Cons(7) = "&factor%5Blrev2_p%5D="
Cons(8) = "&factor%5Bns_p%5D="
Cons(9) = "&factor%5Btt10_p%5D="
Cons(10) = "&factor%5Bx16r_p%5D="
Cons(11) = "&factor%5Bskh_p%5D="
Cons(12) = "&factor%5Bn5_p%5D="
Cons(13) = "&factor%5Bxn_p%5D="
Worksheets(1).Activate
For i = 1 To 13
If Cells(7, i + 1).Text = "S" Then
AlgoIn(i) = "true"
Else
AlgoIn(i) = "false"
End If
Next i
For i = 1 To 13
HRIn(i) = ActiveSheet.Cells(8, i + 1).Text
Next i
For i = 1 To 13
ConsIn(i) = ActiveSheet.Cells(9, i + 1).Text
Next i
For i = 1 To 16
QtdPlacas(i) = ActiveSheet.Cells(4, i + 1).Text
Next i
Custo = ActiveSheet.Cells(12, 2).Text
Dim sURL As String
sURL = "https://whattomine.com/coins?utf8=%E2%9C%93&adapt_q_280x=0&adapt_q_380=0&adapt_q_fury=0&adapt_q_470=0&adapt_q_480=0&adapt_q_570=0&adapt_q_580=0&adapt_q_vega56=0&adapt_q_vega64=0&adapt_q_750Ti=0&adapt_q_1050Ti=0&adapt_q_10606=0&adapt_q_1070=0&adapt_q_1070Ti=0&adapt_q_1080=0&adapt_q_1080Ti=0"
For i = 1 To 13
sURL = sURL & Algos(i) & AlgoIn(i) & HRs(i) & HRIn(i) & Cons(i) & ConsIn(i)
Next i
sURL = sURL & "&factor%5Bcost%5D=" & Custo & "&sort=Profitability24&volume=0&revenue=24h&factor%5Bexchanges%5D%5B%5D=&factor%5Bexchanges%5D%5B%5D=binance&factor%5Bexchanges%5D%5B%5D=bitfinex&factor%5Bexchanges%5D%5B%5D=bittrex&factor%5Bexchanges%5D%5B%5D=cryptobridge&factor%5Bexchanges%5D%5B%5D=cryptopia&factor%5Bexchanges%5D%5B%5D=hitbtc&factor%5Bexchanges%5D%5B%5D=poloniex&factor%5Bexchanges%5D%5B%5D=yobit&dataset=&commit=Calculate"
ActiveSheet.Cells(1, 1) = sURL
Worksheets(2).Activate
With ActiveSheet.QueryTables.Add(Connection:="URL;" & sURL, Destination:=Range("A1"))
>>>.Refresh BackgroundQuery:=False<<< ERROR LINE
.SaveData = True
End With
End Sub
所以,很长的历史记录短:代码使用用户在一个表(第1号)中给出的一些信息,并使用它来徘徊各种字符串以形成我们想要提取数据的URL。 错误消息:运行时错误&#39; 1004&#39;应用程序定义或对象定义错误
OBS:&#34; ActiveSheet.Cells(1,1)= sURL&#34; line是为了检查所使用的URL是否正常工作。它是。
OBS2:以下是由here形成的示例网址。
想要的表位于页面的末尾。
就是这样。 我绝望了。 第一篇文章,希望我不要违反任何规则,希望你能帮忙。